|

List Home > Programming / Scripting > [ Post New Problem ]
Welcome back !
| TrackingID : | 233 |
| Posted : | Sunday, November 09th, 2003 10:39:38 AM |
| By : | richardfox |
| ID of last row inserted | Configuration: |
How can I get the primary key of the row I just inserted? I am using the mssql_ functions, MS SQL Server
thanks,
Rich
Additional Comments: Also how can I do it in MySQL
| Operating System : MS Windows 98
|
Related Problems : Comments :
Re: id of last row inserted by nibbleguru on November 09th, 2003 10:41:07 AM In mySql, use mysql_insert_id().
For MS SQL Server try
$query = "SELECT @@IDENTITY"; |
Re: ID of last row inserted by Anonymous Ghost on November 09th, 2003 10:45:02 AM using @@identity may faile in different cases. I do it like that. I add a additional column with default NULL to the table. When inserting a new row i put a value in that column. Then I search for the row with that value and take the ID from that row. For preaparing the next insert you have to set the value in the additional colllum to Null. |
Re: ID of last row inserted by richardfox on November 09th, 2003 10:48:40 AM thx, it worked. |
Re: ID of last row inserted by Anonymous Ghost on August 23rd, 2004 04:04:36 AM UserWorkflow userWorkflow = new UserWorkflow();
userWorkflow.addUser(userBean);
List userDTOFromDB = userWorkflow.getCompanyAdmins(userBean.getCompanyID() |
Re: ID of last row inserted by Anonymous Ghost on August 23rd, 2004 04:09:20 AM how to get ID from company using in user
action
UserWorkflow userWorkflow = new UserWorkflow();
userWorkflow.addUser(userBean);
List userDTOFromDB = userWorkflow.getCompanyAdmins(userBean.getCompanyID()) |
Re: ID of last row inserted by Anonymous Ghost on November 16th, 2004 02:23:13 PM sadfsadf |
Related Problems :
List Home > Programming / Scripting > [ Post New Problem ] |
|