Is there any solution? Do you know some and would like to share? Please
TomOk, I've found : @.@.IDENTITY|||Hi, you may use the @.@.identity, but keep in mind that this is the
identity across all connections. Therefore if user 1 inserts a row and
a identity is given for this row, after this user2 inserts a rows and
after this user1 is querying the @.@.identity value, he will see the
Identity from user2. See the BOl for more information:
"@.@.IDENTITY and SCOPE_IDENTITY return the last identity value generated
in any table in the current session. However, SCOPE_IDENTITY returns
the value only within the current scope; @.@.IDENTITY is not limited to a
specific scope."
HTH, jens Suessmeyer.|||Thanks!|||Jens:
I believe that @.@.IDENTITY and SCOPE_IDENTITY are both limited to the current
connection, so, in your example, anything user2 does on a different
connection will not affect either @.@.IDENTITY or SCOPE_IDENTITY . The reason
to use SCOPE_IDENTITY is that it is not affected by anything that happens in
triggers that run as a result of the INSERT.
Mike A.
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1139061571.055706.227700@.g44g2000cwa.googlegroups.com...
> Hi, you may use the @.@.identity, but keep in mind that this is the
> identity across all connections. Therefore if user 1 inserts a row and
> a identity is given for this row, after this user2 inserts a rows and
> after this user1 is querying the @.@.identity value, he will see the
> Identity from user2. See the BOl for more information:
> "@.@.IDENTITY and SCOPE_IDENTITY return the last identity value generated
> in any table in the current session. However, SCOPE_IDENTITY returns
> the value only within the current scope; @.@.IDENTITY is not limited to a
> specific scope."
> HTH, jens Suessmeyer.
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment