Sunday, November 21, 2010

How to get Id of Just Inserted Value in SQL

Hi everyone,
This is a Simple example of Getting Unique Id (Auto Id) for the inserted value after insertion of values in SQL table

Declare @subjectid INT =NULL out
-----Insertion Process-----------

Insert into Subject(SyllabusID,ClassroomID,Subject)
values(@syllabusid ,@classroomid ,@strsubject )

------Get Id into @subjectid----
set @subjectid =SCOPE_IDENTITY ();

Happy Coding,
Regards,
Krunal Panchal

No comments:

Post a Comment