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