March 26, 2003 at 4:00 pm
Doesn't SQL Server have an Updated table, like inserted and deleted? I'm not finding it. If not, how do I get the updated ID?
Steve Miller
March 26, 2003 at 5:45 pm
the new id is in inserted. If you want the old one, it is in deleted.
Steve Jones
March 26, 2003 at 6:31 pm
inserted and deleted tables are used in conjunction with triggers.
See example below:
/* -- cut here -- */
use tempdb
begin tran
set nocount on
create table table1(id int identity(1,1), value varchar(50));
go
create trigger tr_table1 on table1 after insert as
begin
select 'This is from the inserted table -->', * from inserted;
end
go
insert into table1(value) values('hello world');
set nocount off
rollback
/* -- cut here -- */
HTH
Billy
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply