Explain about SCOPE_IDENTITY..

 Posted by Bharathi Cherukuri on 7/24/2012 | Category: Sql Server Interview questions | Views: 1339 | Points: 40
Answer:

This SCOPE_IDENTITY function is used to return a value which is the last generated identity in the current scope.
This scope is of different types. This scope can be a stored procedure or a module or a function or a batch.

Example:

INSERT INTO [Northwind].[dbo].[Shippers]([CompanyName],[Phone])
VALUES ('Load Runner','(503) 555-9830')

SELECT SCOPE_IDENTITY()


Output
4


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response