SQL Azure - 在数据库之间复制表 [英] SQL Azure - copy table between databases

查看:37
本文介绍了SQL Azure - 在数据库之间复制表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行以下 SQL:

I am trying to run following SQL:

INSERT INTO Suppliers ( [SupplierID], [CompanyName]) 
Select  [SupplierID], [CompanyName] From [AlexDB]..Suppliers

并收到错误在此版本的 sql server 中不支持对数据库和/或服务器名称的引用"

and got an error "reference to database and/or server name in is not supported in this version of sql server"

知道如何在服务器内部"的数据库之间复制数据吗?我可以将数据加载到客户端,然后返回到服务器,但是速度很慢.

Any idea how to copy data between databases "inside" the server? I can load data to client and then back to server, but this is very slow.

推荐答案

我知道这已经过时了,但我有另一种手动解决方案来解决一个临时问题.

I know this is old, but I had another manual solution for a one off run.

使用 SQL Management Studio R2 SP1 连接到 azure,我右键单击源数据库并选择生成脚本.

Using SQL Management Studio R2 SP1 to connect to azure, I right click the source database and select generate scripts.

在向导中,在我选择了我的表后,我选择了我想要输出到查询窗口,然后单击高级.属性窗口的一半左右有一个要编写脚本的数据类型"的选项.我选择它并将其更改为仅数据",然后我完成了向导.

during the wizard, after I have selected my tables I select that I want to output to a query window, then I click advanced. About half way down the properties window there is an option for "type of data to script". I select that and change it to "data only", then I finish the wizard.

然后我要做的就是检查脚本,重新排列插入的约束,并更改顶部的 using 以针对我的目标数据库运行它.

All I do then is check the script, rearrange the inserts for constraints, and change the using at the top to run it against my target DB.

然后我右键单击目标数据库并选择新查询,将脚本复制到其中,然后运行它.

Then I right click on the target database and select new query, copy the script into it, and run it.

完成,数据已迁移.

希望对某人有帮助

这篇关于SQL Azure - 在数据库之间复制表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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