日期:2014-05-18 浏览次数:20504 次
create table a ( id int primary key identity(1,1), name varchar(50) ) create table b ( id int primary key, name varchar(50) ) declare @returnID int insert into a (name) values ('testa') select @returnID=@@identity --获取a中插入的数据的ID insert into b (id,name) values (@returnID,'testb') select * from a select * from b drop table a drop table b