Wednesday, May 11, 2022

SQL Server Scope Identity

 USE AdventureWorks2012;  

GO  

INSERT INTO Person.ContactType ([Name]) VALUES ('Assistant to the Manager');  

GO  

SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY];  

GO  

SELECT @@IDENTITY AS [@@IDENTITY];  

GO  


reference:- https://docs.microsoft.com/en-us/sql/t-sql/functions/scope-identity-transact-sql?view=sql-server-ver15

https://www.c-sharpcorner.com/UploadFile/rohatash/identity-and-scope_identity-in-sql-server-2012/

No comments:

Post a Comment