How get last inserted ID in SQL Server 2012 -
how last inserted id in sql server 2012? shows null me.
assuming table is
create table test ( id int identity(1,1) primary key , testdata varchar(100) not null )
this works
insert dbo.test (testdata) values ('test') select @@identity id
as (better answer)
insert dbo.test (testdata) values ('test') select scope_identity() id
i don't have enough information know why yours not work. in table structure? need more information answer this.
Comments
Post a Comment