TechNet
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Returns the last-inserted identity value.



SELECT @@IDENTITY AS TEMPNAME
or
SELECT @@IDENTITY AS [TEMPNAME]
or
SELECT @@IDENTITY AS "TEMPNAME"


numeric


If you create a table in SQL Server Compact 3.5 that uses an identity column and then run a query in which an INSERT fails, the value of @@IDENTITY will still increment.

Show:
© 2016 Microsoft