怎样把sql7.0数据库中的表和视图,导出到sql2000的数据库中??

怎样把sql7.0数据库中的表和视图,导出到sql2000的数据库中??

我的服务器是sql7.0,我怎么才能把服务器的数据导入到我的机器上,我的机器是sql2000,主要是视图的导出。请问各位了!!

谢谢!!!!!!!!
---------------------------------------------------------------

--如果你的视图不超过4000个字符的话(通常没那么长)

select m.text from (

select a.text,a.id
from syscomments a,sysobjects b
where a.id = b.id and b.type = 'v'

union all

select 'go',a.id+0.5
from syscomments a,sysobjects b
where a.id = b.id and b.type = 'v'
) as m
order by m.id
---------------------------------------------------------------

导成sql脚本,到2000中执行
---------------------------------------------------------------

--设置将结果保存为文件,支持8000个字符。

select m.text from (

select text=rtrim(c.text)+isnull(ltrim(d.text),''),c.id from
(select a.text,a.id
from syscomments a,sysobjects b
where a.id = b.id and colid = 1 and b.type = 'v') as c
left join syscomments d
on c.id = d.id and d.colid = 2

union all

select 'go',a.id+0.5
from syscomments a,sysobjects b
where a.id = b.id and b.type = 'v'
) as m
order by m.id

---------------------------------------------------------------

右键生成sql语句

或使用DTS导入导出工具

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus