--啟用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 閱讀(2769)
評論(0) 編輯 收藏