Insert identity column value into table from another table?

前端 未结 3 597
不思量自难忘°
不思量自难忘° 2020-12-21 04:43
create table #test (a int identity(1,1), b varchar(20), c varchar(20))

insert into #test (b,c) values (\'bvju\',\'hjab\')
insert into #test (b,c) values (\'bst\',\'         


        
3条回答
  •  被撕碎了的回忆
    2020-12-21 04:57

    insert into #test (b,c) values ('bvju','hjab')
    insert into #sample(e,f) values (@SCOPE_IDENTITY(), 'jkhjk')
    

    @SCOPE_IDENTITY() returns the last identity value used

提交回复
热议问题