问题描述
我有两个 SQL Server(都是 2005 版本).
I have two SQL Servers (both 2005 version).
我想将多个表从一个迁移到另一个.
I want to migrate several tables from one to another.
我试过了:
在源服务器上,我右键单击了数据库,选择了
Tasks/Generate scripts
.问题是在Table/View options
下没有Script data
选项.
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.
然后我使用 Script Table As/Create script
来生成 SQL 文件,以便在我的目标服务器上创建表.但我仍然需要所有数据.
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.
然后我尝试使用:
SELECT *
INTO [destination server].[destination database].[dbo].[destination table]
FROM [source server].[source database].[dbo].[source table]
但我收到错误:
对象包含超过最大数量的前缀.最大值是2.
Object contains more than the maximum number of prefixes. Maximum is 2.
有人可以指出我问题的正确解决方案吗?
Can someone please point me to the right solution to my problem?
推荐答案
试试这个:
使用
Script Table As/Create Script
步骤中的脚本在目标服务器上创建表
create your table on the target server using your scripts from the
Script Table As / Create Script
step
在目标服务器上,然后您可以发出 T-SQL 语句:
on the target server, you can then issue a T-SQL statement:
INSERT INTO dbo.YourTableNameHere
SELECT *
FROM [SourceServer].[SourceDatabase].dbo.YourTableNameHere
这应该可以正常工作.
这篇关于将表数据从一个 SQL Server 导出到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!