首页 > 数据库 > mysql教程 > sqlserver批量插入

sqlserver批量插入

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2016-06-07 15:39:41
原创
1470 人浏览过

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中

相关标签:
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
tp6连接sqlserver数据库问题
来自于 1970-01-01 08:00:00
0
0
0
php 怎样调用sqlserver的分页储存过程
来自于 1970-01-01 08:00:00
0
0
0
php 7.2.10 链接 SQLserver2008r2 报错
来自于 1970-01-01 08:00:00
0
0
0
Laravel 中无法连接 SQL Server
来自于 1970-01-01 08:00:00
0
0
0
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板