Tuesday, March 6, 2012

When @@identity fails

create table t (x int identity(1,1))
go
create table t2 (x int identity(10,1))
go
create trigger t_trig on t
after insert
as
begin
insert t2  DEFAULT VALUES
end
go
insert t  DEFAULT VALUES
SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY];
SELECT @@IDENTITY AS [@@IDENTITY];
select ident_current('t') as 'ident_current'



No comments:

Post a Comment