--啟用Ad Hoc Distributed Queries
--(使用以下兩句代碼的原因:下面的sql中,其中有幾個(gè)從其他數(shù)據(jù)庫(kù)導(dǎo)入數(shù)據(jù)的語(yǔ)句,所以必須得先啟用Ad Hoc Distributed Queries,使用結(jié)束后,最好關(guān)閉它 )
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
--使用完成后,關(guān)閉Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
--(使用以下兩句代碼的原因:下面的sql中,其中有幾個(gè)從其他數(shù)據(jù)庫(kù)導(dǎo)入數(shù)據(jù)的語(yǔ)句,所以必須得先啟用Ad Hoc Distributed Queries,使用結(jié)束后,最好關(guān)閉它 )
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
--使用完成后,關(guān)閉Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure