2

How do you get the identity column value after an insert in SQL Server Compact 3.5?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Kumar
  • 10,997
  • 13
  • 84
  • 134

3 Answers3

4

I think what you want is @@IDENTITY:

SELECT @@IDENTITY AS Identity

This will return the value of the last identity inserted.

Matthew Jones
  • 25,644
  • 17
  • 102
  • 155
1

I guess you have to use @@IDENTITY. I figured compact would have SCOPE_IDENTITY(), but I guess not. Just try scope_identity to be sure. :)

JP Alioto
  • 44,864
  • 6
  • 88
  • 112
1

I use

SELECT MAX(<IdentityColumn>) FROM <TableName>