如何將一個資料庫導入到另一個資料庫

sunrisehy2003 2003-12-30 04:32:03
各位老兄:
我想將一個資料庫導入到另一個資料庫,但我只想要資料庫中各表的結構,不要記錄
如用select * into #新表 from 原表 where 1=0
對幾個表還可以.
可我的資料庫中有1300多個表.有沒有更好的辦法
...全文
61 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunrisehy2003 2003-12-30
  • 打赏
  • 举报
回复
就是說:如我的原資料庫DB01 ,新資料庫為DB01,怎麼寫

sunrisehy2003 2003-12-30
  • 打赏
  • 举报
回复
tj_dns(愉快的登山者 MVP)
你將資料表存放在那個資料庫
sunrisehy2003 2003-12-30
  • 打赏
  • 举报
回复
wzh1215(四脚蛇),麻煩你說具體一點
wzh1215 2003-12-30
  • 打赏
  • 举报
回复
导出脚本。然后到另一个资料库中执行脚本!
愉快的登山者 2003-12-30
  • 打赏
  • 举报
回复
1。先导库:结构+数据
2。删数据:
declare @i int
declare @s int
declare @n varchar(100)
select identity(int,1,1) as id, name into #t
from sysobjects where type = 'u'
select @s = count(*) from #t
set @i = 1
while @i <= @s
begin
select @n = name from #t where id = @i
set @i = @i + 1
exec ('truncate table '+@n)
end

drop table #t
go
shuiniu 2003-12-30
  • 打赏
  • 举报
回复
j老师找到的!
http://expert.csdn.net/Expert/topic/2607/2607537.xml?temp=.729397

34,594

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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