Replies Back to Article
Retrieving Unique ID after Insert with SQL Server 2000
I have posted some comments on this page before but they seem to be deleted...
What about if you guys start giving some help and reply to our questions.
At the end of the day we are the people that keep coming back.
I had a problem with the extention mentioned here and see that other people as well. It is about an XML file missing.
Do you know how to fix it? Or you are just going to delete this message?
Nicolas
Is it not possible (I think it is) that if two or more users submitted the same insert at similar times that the identity return could be from the another user. Example with two users below, in the order they happen, this problem can manifest itself more frequently when more users are operating the system and/or the same table is being updated by other processes.
1) User 1 - Issues Insert
2) User 2 - Issues Insert
3) User 1 - Retrieve Ident
4) User 2 - Retrieve Ident
Maybe a couple of alternatives are :
1) The table definition must have an alternative primary key (that may be a composite key) but is not the identity column, immediately after the insert, issue a select with this key to get the identity column value. If the table has been defined with a unique key then you will always get the correct identity value back.
2) Use a stored procedure that performs the insert and the does a select @@identity all within a transaction.
3) Put option 1 in a SP - I think this would be the most robust.

[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in string in query expression 'SeekUsername='%'"
Please tell me what is wrong
I am using dreamweaver ultradev: in the insert record insertion form canot be completed if this is not correct
Thank you
lou
What would we do without Richard Davies?
Thanks...you made my life a little easier.
hi does this solution work with MySQL because im getting this error
Microsoft OLE DB Provider for ODBC Driverserror '80040e31'
Unknown system variable 'NOCOUNT'
if not is there a way to adjust it so it does or is there a tutorial you could link me to
thanks