如何在SQL Server 2000中将数据从一个数据库插入另一个数据库
问题描述:
如何将数据从一个数据库表(DB a1)插入到同一个表中,但是插入到sql server 2000中的另一个数据库表(DB a2)中?我的意思是我如何指定这是一个来自这个数据库的表,以及该数据库中的那个表?
我尝试了什么:
i tries =插入DB a1.table1 select * from DB a2.table1
how can i insert data from one database table(DB a1) into the same table but into another database table(DB a2) in sql server 2000 ? i mean how can i specify this is a table from this database , and that table from that database?
What I have tried:
i tried = insert into DB a1.table1 select * from DB a2.table1
答
您的选项包括
1)链接服务器(如果支持,google让我认为是这样)
Sql 2000链接服务器 - Google搜索 [ ^ ]
hyperlink - SQL Server 2000创建到SQL Server 2008的链接服务器 - Stack Overflow [ ^ ]
2)生成脚本方法
将数据从一个数据库合并到另一个数据库 - SQL Server 2000 ASP.NET论坛 [ ^ ]
如何从中插入数据SQL Server 2000中的另一个数据库 - Google搜索 [ ^ ]
如何在SQL Server 2000中将数据从一个数据库插入另一个数据库 - Google搜索 [ ^ ]
Your options include
1) A linked server (if that is supported, google makes me think it is)
Sql 2000 Linked Server - Google Search[^]
hyperlink - SQL Server 2000 creating a linked server to SQL Server 2008 - Stack Overflow[^]
2) Generate scripts method
Merge data from one db to another db - SQL Server 2000 | The ASP.NET Forums[^]
How to insert data from one database to another in SQL server 2000 - Google Search[^]
How to insert data from one database to another in SQL server 2000 - Google Search[^]
示例:
Example:
Use Country
INSERT INTO dbo.State(State_Name)
SELECT State_Name
FROM CollegeDb.dbo.State
INSERT INTO dbo.City(State_ID, City_Name)
SELECT State_ID, City_Name
FROM CollegeDb.dbo.City
Bulk Copy feature of ADO.NET might help you take a look at that :
MSDN - Multiple Bulk Copy Operations (ADO.NET)
An example article