sqlServer中将一个服务器的数据库中的表,新增到另一个服务器的数据库中
Sql代码:
select * into ShopToCar_tblTwo from openrowset('SQLOLEDB','192.168.1.101(要拷贝的服务器地址)';'sa(服务器登录名)';'zhoushu(服务器密码)',carcloud(数据库名).dbo.ShopToCar_tbl(表名))
问题:
SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'Ad Hoc Distributed Queries'。有关启用 'Ad Hoc Distributed Queries' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。
解决:
--先开启,开启操作完后要关闭 开启: exec sp_configure 'show advanced options',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure 关闭: exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure exec sp_configure 'show advanced options',0 reconfigure
浙公网安备 33010602011771号