将表数据从一个SQL Server导出到另一个 [英] Export table data from one SQL Server to another
问题描述
我有两个SQL Server(2005版本)。
我想将多个表从一个表移植到另一个。
我试过:
-
在源服务器上,我右键点击了数据库,选择了
任务/生成脚本
。
问题是在表/视图选项
下没有脚本数据
选项。 -
然后我使用
脚本表As / Create脚本
生成SQL文件,以便在目标服务器上创建表。但是我仍然需要所有数据。
然后我尝试使用:
pre>
SELECT *
INTO [destination server]。[destination database]。[dbo]。[destination table]
FROM [source server]源数据库] [dbo]。[源表]
但是我收到错误:
对象包含超过最大数量的前缀。最高是
2。
有人可以指出我正确的解决我的问题吗?
尝试这样:
-
创建你的表在目标服务器上使用脚本从
脚本表As / Create脚本
步骤 -
服务器,然后可以发出一个T-SQL语句:
INSERT INTO dbo.YourTableNameHere
SELECT *
FROM [SourceServer]。[SourceDatabase] .dbo.YourTableNameHere
这应该是正常的。
I have two SQL Servers (both 2005 version).
I want to migrate several tables from one to another.
I have tried:
On source server I have right clicked on the database, selected
Tasks/Generate scripts
. The problem is that underTable/View options
there is noScript data
option.Then I used
Script Table As/Create script
to generate SQL files in order to create the tables on my destination server. But I still need all the data.
Then I tried using:
SELECT *
INTO [destination server].[destination database].[dbo].[destination table]
FROM [source server].[source database].[dbo].[source table]
But I get error :
Object contains more than the maximum number of prefixes. Maximum is 2.
Can someone please point me to the right solution to my problem?
Try this:
create your table on the target server using your scripts from the
Script Table As / Create Script
stepon the target server, you can then issue a T-SQL statement:
INSERT INTO dbo.YourTableNameHere SELECT * FROM [SourceServer].[SourceDatabase].dbo.YourTableNameHere
This should work just fine.
这篇关于将表数据从一个SQL Server导出到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!