高手: Sql 语句插入数据 insert into tab_name1 (uId,uEmail,typeName) select top 3 uId , kkEmail,kkTypeName from Tab_other
我想执行的同时做插入到另一个表 insert into tab_name2 (uId2,uEmail2,typeName2)
====== 即我本来想 类似做这样的操作.
insert into tab_name1 (uId,uEmail,typeName) insert into tab_name2 (uId2,uEmail2,typeName2) select top 3 uId , kkEmail,kkTypeName from Tab_other
请问怎么执行呢?
------解决方案--------------------
------解决方案--------------------
用output就行了
SQL code
insert into tab_name1 (uId,uEmail,typeName)
OUTPUT INSERTED.uId,INSERTED.uEmail,INSERTED.typeName
INTO tab_name2
select top 3 uId , kkEmail,kkTypeName from Tab_other