Home Forums SQL Server 7,2000 Administration @@identity RE: @@identity
Andy Warren
SSC Guru
Points: 119902
More actions
October 18, 2002 at 5:42 am
#438872
declare @NewKey int
insert into table1(col) values (blah)
select @NewKey=@@Identity
If you're using SQL2K you should use the scope_identity() function instead.
Andy
http://www.sqlservercentral.com/columnists/awarren/
AndySQLAndy - My Blog!Connect with me on LinkedInFollow me on Twitter