如何通过在sql中查询将数据从一个服务器插入另一个表 [英] how to insert data from one server to another table wise by query in sql

查看:56
本文介绍了如何通过在sql中查询将数据从一个服务器插入另一个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将数据从一个服务器插入到另一个表明智,例如我有表tab_subject它在一个服务器中我想通过在sql server 2008中写入查询将tab_subject的数据发送到另一个服务器我的查询在下面给出



插入192.168.2.30.DbBranchServer.dbo.Tab_subject

(TABKEY,CDESC)

select

distinct

sbj.TABKEY,

sbj.CDESC

主题来自

TAB_SUBJECT sbj

其中SubType ='CBE'

和Status ='1'且

不存在(选择

TABKEY

来自

192.168.2.30.DbBranchServer.dbo.Tab_subject Ts

其中sbj.TABKEY = Ts.TABKEY)



这个查询在这一行给出错误192.168.2.30.DbBranchServer.dbo.Tab_subject



请帮我怎么做。

解决方案

真的,如果你能通知我们会有所帮助该行给出了什么错误。



我会对此进行一次尝试:您通常需要链接服务器来执行此类操作。你可以看一下 - 但它是一个管理权限,你可能想在这里寻求服务器管理员的帮助。




i want to insert data form one server to another table wise for example i have table tab_subject it is in one server and i want sent data of tab_subject to another server by writing query in sql server 2008 my query is given below

Insert into 192.168.2.30.DbBranchServer.dbo.Tab_subject
(TABKEY,CDESC)
select
distinct
sbj.TABKEY ,
sbj.CDESC
Subject from
TAB_SUBJECT sbj
where SubType='CBE'
and Status='1' and
not exists(select
TABKEY
from
192.168.2.30.DbBranchServer.dbo.Tab_subject Ts
where sbj.TABKEY=Ts.TABKEY)

this query is giving error on this line 192.168.2.30.DbBranchServer.dbo.Tab_subject

kindly help me how should i do this .

解决方案

Really, it would have been helpful if you would have informed us of what error the line is giving.

I'll take a stab at this: you normally need "Linked Servers" to do this type of operation. You can look that up - but it's an administrative privilege and you'd probably want to seek the server administrator's help in this.


这篇关于如何通过在sql中查询将数据从一个服务器插入另一个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆