---/创建linkServer
--exec sp_addlinkedserver 'srv_lnk','','SQLOLEDB',' '服务器名'--登陆linkServer
exec sp_addlinkedsrvlogin 'srv_lnk','false',null,' 用户名',' 密码'
--查询linkServer的数据库DataBaseA的表TableA
--Select * From srv_lnk.DataBaseA.dbo.TableA
insert into Pmfg
select * from srv_lnk.DataBaseA.dbo.Pmfg
简单示例:
//创建linkServer
exec sp_addlinkedserver 'srv_lnk','','SQLOLEDB','服务器名'
//登陆linkServer
exec sp_addlinkedsrvlogin 'srv_lnk','false',null,'用户名','密码'
//查询linkServer的数据库DataBaseA的表TableA
Select * From srv_lnk.DataBaseA.dbo.TableA
//List the tables in the linked server
EXEC sp_tables_ex txtsrv
参考地址:http://www.cnblogs.com/wangdaye/archive/2010/07/05/1771556.html