SQL
insert into table_name(colum1,colum2)
select colum1,colum2
from opendatasource('sqloledb','data source=服务器名;user id=用户名 ;password=密码 ').database_name.dbo.table_name
如执行出现以下错误”sql server 阻止了对组件 /'ad hoc distributed queries/' 的访问“,解决方法如下:
启用Ad Hoc Distributed Queries:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
oracle
oracle 中添加配置
test=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.221.0.1)(PORT = 1001))
)
(CONNECT_DATA =
(SERVICE_NAME = servname)
)
)
create public database link linkname connect to 用户名 identified by 密码
using 'test'
select * from table_name@linkname
注意有时候会报 "insufficienct privilege" 请确定角色中是否开通connect的权限哦