日期:2014-05-17  浏览次数:20408 次

c#链接sqlserver的问题
SQL code
select * into WW_KnowItemRelation_1 from WW_KnowItemRelation

其中WW_KnowItemRelation_1是在a服务器上的,WW_KnowItemRelation是在b服务器上的,
现在我们默认都是链接的a服务器所以操作WW_KnowItemRelation_1很简单,
但是WW_KnowItemRelation这张表在a上没有,怎么在执行这条sql的时候同时链接b服务器上的WW_KnowItemRelation呢?

------解决方案--------------------
SQL code
select * into [a].[数据库名]..WW_KnowItemRelation_1 from [b].[数据库名]..WW_KnowItemRelation

------解决方案--------------------
在b服务器上建指向a服务器的linkserver,然后
SQL code

 insert into [linkserver名].[数据库名].[架构名].WW_KnowItemRelation_1 
 select * from WW_KnowItemRelation

------解决方案--------------------
我觉得你放到sql里面应该就可以了。
------解决方案--------------------
探讨
SQL code
select * into WW_KnowItemRelation_1 from WW_KnowItemRelation

其中WW_KnowItemRelation_1是在a服务器上的,WW_KnowItemRelation是在b服务器上的,
现在我们默认都是链接的a服务器所以操作WW_KnowItemRelation_1很简单,
但是WW_KnowItemRelat……