关于复制表

kickken 2003-08-22 11:39:30
从A 数据库中复制 A1,A2 表 到B 数据库, 不复制内容
TSQL 怎么写? B 数据库为空数据库
...全文
102 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
nboys 2003-08-22
  • 打赏
  • 举报
回复
复制结构:

在A数据库中右击表---复制---到B数据库的查询分析器中---粘贴---执行

复制数据:

insert into B..tableName select * from A..tableName

or

select * into B..tableName from A.tableName
pengdali 2003-08-22
  • 打赏
  • 举报
回复
select * into b..a1 from a.a1 where 1=2
select * into b..a2 from a.a2 where 1=2

或:

select top 0 * into b..a1 from a.a1
select top 0 * into b..a2 from a.a2
CrazyFor 2003-08-22
  • 打赏
  • 举报
回复
说明:复制表(只复制结构,源表名:a 新表名:b)

select * into B..A1 from A..a1 where 1<>1
select * into B..A2 from A..a2 where 1<>1

CrazyFor 2003-08-22
  • 打赏
  • 举报
回复
说明:复制表(只复制结构,源表名:a 新表名:b)

select * into B..A1 from A..a1 where 1<>1
select * into B..A2 from A..a2 where 1<>1

kfcn 2003-08-22
  • 打赏
  • 举报
回复
select top 0 * into b..a1 from a..a1
select top 0 * into b..a2 from a..a2
zjcxc 2003-08-22
  • 打赏
  • 举报
回复
或者:
查询分析器--右键A库的a1表--在剪切板中编写脚本--新建
选择B库--右边的窗口粘贴--按F5执行

查询分析器--右键A库的a2表--在剪切板中编写脚本--新建
选择B库--右边的窗口粘贴--按F5执行
zjcxc 2003-08-22
  • 打赏
  • 举报
回复
select top 0 * into B..a1 from A..a1
select top 0 * into B..a2 from A..a2
hjb111 2003-08-22
  • 打赏
  • 举报
回复
select * into B..a1 from A..a1 where 1=2
select * into B..a2 from A..a2 where 1=2

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧