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 |
|
timmemac
Starting Member
6 Posts |
Posted - 2010-05-12 : 20:12:45
|
| Hi, I have a table purchases,the column PurchaseNo is auto incremented each time a new record is inserted.The insertion is done using a Stored Proc.How to retrieve newly added PurchaseNo.Pls list all the possible waysRegardsTim |
|
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2010-05-12 : 20:24:04
|
| [code]SELECT @@identity AS newID[/code] |
 |
|
|
dineshrajan_it
Posting Yak Master
217 Posts |
Posted - 2010-05-13 : 08:47:16
|
| scope_identity() is more preferred than @@identity as @@identity may fail when the table has trigger in itIam a slow walker but i never walk back |
 |
|
|
|
|
|