Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get last inserted id

Is there any way I can get the last inserted ID if I am using SQL Server CE? I have 2 tables and when a new record is created, I want to be able to save the ID in the second table too.

like image 509
Rocshy Avatar asked Nov 29 '22 15:11

Rocshy


1 Answers

SELECT @@IDENTITY

will retrieve the last auto-generated identity value in SQL Server.

like image 100
ron tornambe Avatar answered Dec 02 '22 05:12

ron tornambe