sql server identity value after insert in stored procedure

Jak
Jak
908 Points
132 Posts

sql server identity value after insert in stored procedure

Views: 9291
Total Answered: 1
Total Marked As Answer: 1
Posted On: 04-May-2015 05:16

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
4960 Points
31 Posts
         

Hi,
Suppose I have a table with IDENTITY(1,1) as:

CREATE TABLE [dbo].[tablename](
[IdentityColumm] [bigint] IDENTITY(1,1) NOT NULL,
)

 

In Storred procedure we can get identiry value as:

INSERT INTO tablename(...)
VALUES(...)
SET @IdentityValue=ISNULL(SCOPE_IDENTITY(),0)
Posted On: 03-May-2015 16:56
 Log In to Chat