如何将DB中的标识插入表中的数据插入到没有标识插入/约束的另一个DB中? [英] How to insert data from the tables in identity insert of a DB to another DB which has no identity insert/constraints?
本文介绍了如何将DB中的标识插入表中的数据插入到没有标识插入/约束的另一个DB中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将数据的Identity Insert中的表中的数据插入到另一个DB的表中,该数据库没有通过通用脚本的标识插入/约束。
有大量数据要插入。
我尝试过:
获取标识插入表并通过游标传递它们。但其余部分是通过通用脚本完成的。
I want to insert data from the tables in Identity Insert of a DB to the tables of another DB which has no identity Insert/constraints via a generic script.
There is bulk data to be inserted.
What I have tried:
Fetched the identity Insert tables and passed those via cursor. But the rest is to be done via a generic script.
推荐答案
如果表结构相同,只需用向导创建脚本,使用以下方式
选项1 - 右键单击要复制的数据库
- 选择任务> '生成脚本'
- '选择特定数据库对象'
- 检查'表'
- 标记'保存到新查询窗口'
- 点击'高级'
- 将'脚本数据类型'设置为'架构和数据'
- 下一步,下一步>
- 您现在可以在新数据库上运行生成的查询。
选项2
- 右键单击数据库你要复制
- '任务'> '导出数据'
- 下一步,下一步
- 选择要将表格复制到的数据库
- 标记'从一个或多个复制数据表格或视图'
- 选择要复制的表格
- 完成
If the table structure is same, simple create a scripts with wizard, use following ways
Option 1 - Right click on the database you want to copy
- Choose 'Tasks' > 'Generate scripts'
- 'Select specific database objects'
- Check 'Tables'
- Mark 'Save to new query window'
- Click 'Advanced'
- Set 'Types of data to script' to 'Schema and data'
- Next, Next
- You can now run the generated query on the new database.
Option 2
- Right click on the database you want to copy
- 'Tasks' > 'Export Data'
- Next, Next
- Choose the database to copy the tables to
- Mark 'Copy data from one or more tables or views'
- Choose the tables you want to copy
- Finish
这篇关于如何将DB中的标识插入表中的数据插入到没有标识插入/约束的另一个DB中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文