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 |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2008-08-20 : 09:31:28
|
| Hi,I'm looking at upgrading one of my SPROCS, by adding a 2nd return value to it. I want to populate this 2nd return value with the @@IDENTITY value (the identity column of the row that was just inserted by the insert query)It's for a very large table that I want to add this to. Does tablesize affect performance of @@IDENTITY ? Is it another lookup? Or is it a value thats already computed and available to the SPROC.Any help much appreciated !!Thanks,Mike123 |
|
|
mcrowley
Aged Yak Warrior
771 Posts |
Posted - 2008-08-20 : 09:42:01
|
| The value of @@identity is stored in the process memory for the connection. There should be no performance impact using it. You may also want to look into using SCOPE_IDENTITY, if you use a lot of triggers that could cloud the value of @@identity. |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2008-08-20 : 09:47:32
|
| awesome thanks for your help!mike123 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-20 : 10:23:22
|
| A good article which explains the difference of eachhttp://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/ |
 |
|
|
|
|
|