方法一:
select * from servername.dbo.tablename
方法二:
select * from OPENDATASOURCE(
‘SQLOLEDB‘,
‘Data Source=远程ip;User ID=sa;Password=密码‘
).库名.dbo.表名
where 条件
select top 100 * from OPENDATASOURCE(
‘SQLOLEDB‘,
‘Data Source=192.168.6.100;User ID=sa;Password=1234‘
).[zhaolx-test].dbo.TGongwen
where gid <5
insert into OPENDATASOURCE(
‘SQLOLEDB‘,
‘Data Source=192.168.6.100;User ID=sa;Password=1234‘
).[zhaolx-test].dbo.t_aaa (id ,name )values(‘001‘,‘Tom‘)
select top 100 * from OPENDATASOURCE(
‘SQLOLEDB‘,
‘Data Source=192.168.6.100;User ID=sa;Password=1234‘
).[zhaolx-test].dbo.t_aaa
时间: 2024-11-10 06:53:45