You can get latest generated id of a table in two ways..
1) Select top 1 id from a table and order by it desc like this..
SELECT TOP 1 id FROM TABLENAME ORDER BY DESC
2) You can use @@IDENTITY it gives latest inserted identity column like this..
INSERT INTO (.............)
SELECT @@IDENTITY
No comments :
Post a Comment