Question

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

Was it helpful?

Solution

I think what you want is @@IDENTITY:

SELECT @@IDENTITY AS Identity

This will return the value of the last identity inserted.

OTHER TIPS

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. :)

I use

SELECT MAX(<IdentityColumn>) FROM <TableName>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top