将包含数据的表从一个数据库导入另一个数据库 [英] Importing tables with data from one Database to Another Database

查看:210
本文介绍了将包含数据的表从一个数据库导入另一个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我有两个DB,名为Contacts和Master_Contacts.In Contacts DB我有5个数据表。

i想要用数据复制这些表( 从联系人DB )到Master_Contacts DB。



关于任何答案回复我。





问候,

MURUGESAN.P

Hi Friends,
I ve Two DBs named Contacts And Master_Contacts.In Contacts DB I ve 5 tables with data.
i want to copy these all tables with data(from Contacts DB) to Master_Contacts DB.

Regarding any answers reply me.


Regards,
MURUGESAN.P

推荐答案

从一台服务器转移到另一台服务器然后你必须使用LinkedServer并传输数据。



使用此系统SP添加链接服务器:sp_addlinkedserver





如果您在数据库中进行传输,则使用带数据库名称的简单select into子句语句。
For transferring from one server to another server then you have to use LinkedServer and transfer the data.

use this System SP to add Linked server: sp_addlinkedserver


IF you are transferring within databse then use simple select into clause statement with database name.


您可以使用Sql Query



You can use Sql Query

Select * into destinationdb.dbo.tablename from sourcedbname.dbo.tablename





假设表格详细信息在databse1中,我们想将此表复制到database2然后





Suppose table "Details" is in databse1 and we want to copy this table to database2 then

Select * into databse2.dbo.Tablename from databse1.dbo.Details







这里db2.dbo.Tablename

表名你可以根据需要给出任何名字。




here db2.dbo.Tablename
Tablename u can give any name according to ur need.


这篇关于将包含数据的表从一个数据库导入另一个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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