ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles Bayon" <ibatis....@gmail.com>
Subject Re: Do not use <selectKey> with SCOPE_IDENTITY and MSSQL?
Date Tue, 18 Sep 2007 06:35:08 GMT
Returns the last identity value inserted into an identity column in the same
A scope is a module: a stored procedure, trigger, function, or batch.
Therefore, two statements are in the same scope if they are in the same
stored procedure, function, or batch.

SCOPE_IDENTITY and @@IDENTITY return the last identity values that are
generated in any table in the current session.
However, SCOPE_IDENTITY returns values inserted only within the current
scope; @@IDENTITY is not limited to a specific scope.

>From http://msdn2.microsoft.com/en-us/library/ms190315.aspx

So if you want to use the selectKey statement, use the @@IDENTITY.

If you want you can make an entry in the wiki


<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>

View raw message