如何把A数据库里的表用sql语句添加到B数据库
答案:5 悬赏:50
解决时间 2021-02-21 01:28
- 提问者网友:痞子房西
- 2021-02-20 10:09
如何把A数据库里的表用sql语句添加到B数据库
最佳答案
- 二级知识专家网友:湫止没有不同
- 2021-02-20 10:49
B数据库存在表
use B
go
insert into tablename
select * from A【.schema】.tablename
B数据库不存在表,用下面语句就省得建表了
use B
go
select * into tablename
from A【.schema】.tablename
schema系统默认的是dbo,可以根据自己的需要做修改
use B
go
insert into tablename
select * from A【.schema】.tablename
B数据库不存在表,用下面语句就省得建表了
use B
go
select * into tablename
from A【.schema】.tablename
schema系统默认的是dbo,可以根据自己的需要做修改
全部回答
- 1楼网友:滚出爷的世界
- 2021-02-20 15:27
--==========同一服务器上跨数据库数据拷贝==========
set identity_insert news on
insert into [p35cn11-10].dbo.news(newsid,title,content,typeid,nfrom,dateandtime,hits,power,keywords,enabled,uploadfiles) select id,tit,content,ctype,comefrom,adtime,visitnum,power,keywords,enabled,uploadfiles from [p35cn3_26].dbo.article
insert into b(a, b, c) select d,e,f from b;
set identity_insert news off
- 2楼网友:两不相欠
- 2021-02-20 14:08
insert into t
seelct * from [数据库A名称].dbo.t where 这个语句在数据库B里面执行!
- 3楼网友:不傲怎称霸
- 2021-02-20 13:40
select A..table into B..table
A B 数据表结构要一样
- 4楼网友:甜野猫
- 2021-02-20 12:05
insert into bb select * from aa
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯