October 18, 2002 at 5:35 am
Hello everyone,
I was wondering does anyone know who to use @@identity function? Thanks
October 18, 2002 at 5:42 am
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
October 18, 2002 at 10:07 am
If you are using SQL 7 and triggers be careful, as you the identity gets over written
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
October 18, 2002 at 11:00 am
No, I am using sybase, which is very similar to 6.5 sql server, and I am using @@identity in a stored procedure...
October 18, 2002 at 11:06 am
Thanks Andy, this seems to work!!!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply