Friday, June 8, 2012

How to return the ID from the database on insert

Here is the Example of a Insert statement which returns ID of the row got inserted.

DECLARE ID int
INSERT INTO <tablename> (<colums name>) VALUES (<values>)
SELECT ID = SCOPE_IDENTITY()


Hope it will help you.

Thanks
Solomon S.


If information is helpful then don't forget to post comments

No comments: