--启用Ad Hoc Distributed Queries
--(使用以下两句代码的原因:下面的sql中,其中有几个从其他数据库导入数据的语句,所以必须得先启用Ad Hoc Distributed Queries,使用结束后,最好关闭它 )
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
GO
delete from syscode
insert into syscode
select type,code,name,note,value1,value2 FROM opendatasource('SQLOLEDB','Data Source=192.168.1.101;User ID=sa; Password=***').[DATABASE_NAME].dbo.syscode
--使用完成后,关闭Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
posted on 2013-02-03 11:27
Jimi 阅读(2768)
评论(0) 编辑 收藏