sql server 2005远程复制表及“SQL Server阻止了对组件...的访问”解决
--启用Ad Hoc Distributed Queries
--(使用以下两句代码的原因:下面的sql中,其中有几个从其他
数据库导入数据的语句,所以必须得先启用Ad Hoc Distributed Queries,使用结束后,最好关闭它 )
www.2cto.com
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