sqlserver批量插入

WBOY
リリース: 2016-06-07 15:39:41
オリジナル
1334 人が閲覧しました

declare @t table (id int) if(exists(select name from tempdb..sysobjects where name like'%test%' and type='U')) drop table #test Create Table #test(ids int ) insert into 192.168.1.10.数据库.表1(name,password) output inserted.id into @t sele

declare @t table (id int)
if(exists(select name from tempdb..sysobjects where name like'%test%' and type='U'))
   drop table #test
Create Table #test(ids int )
insert into 192.168.1.10.数据库.表1(name,password) output inserted.id into @t
select name ,password
from [user]
where not exists(select b.name from 192.168.1.10.数据库.表1 b where  name= b.name)
insert into  #test(ids) SELECT id FROM @t
insert into insert into 192.168.1.10.数据库.表2(truename,userid)
select username,ids from #test

output不能远程 有没有别的办法 能获取到刚刚插入的所有的主键ID  插入到 表2中

ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!