Tuesday, July 29, 2014

how to get last column


create table t1 (memberid int identity(1,1),col varchar(50))
create table t2 (id2 int identity(1,1),memberid int, col varchar(50))


insert into t1 values('aa')
insert into t1 values('bb')

declare @id int
select @id = scope_identity()
insert into t2 values (@id, 'a---')

select * from t1
select * from t2



drop table t1,t2


No comments:

Post a Comment