Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
boreddy
Posting Yak Master
172 Posts |
Posted - 2008-08-19 : 04:13:38
|
| what is the diffrence between @@identity ,scopidentity |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-19 : 04:23:58
|
| @@identity gives last generated id value (but not necessarily in same scope) while scope_identity always gives the identity generated in same scope.the difference can be noted in case where you've a insert trigger enabled on your table which logs action onto a audit table. @@identity will return the id generated for audit table which is actually done by trigger whilst scope_identity gives id generated inside main table. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-19 : 04:25:23
|
| more explanation below:-http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/ |
 |
|
|
VGuyz
Posting Yak Master
121 Posts |
Posted - 2008-08-19 : 06:17:13
|
| check this blog for more information.http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-08-19 : 06:36:44
|
| maybe it's a kind of parrot-syndromPlanning replaces chance by mistake |
 |
|
|
|
|
|