问题描述
我在 Microsoft SQL Server Management Studio 的数据库(称为 A_db
)中有一个表(称为 A_table
),有 10 行.
I have a Table (call it A_table
) in a database (call it A_db
) in Microsoft SQL Server Management Studio, and there are 10 rows.
我有另一个数据库(叫它B_db
),它有一个表(叫它B_table
),它的列设置与A_table
有.但是 B_table
是空的.
I have another database (call it B_db
), and it has a Table (call it B_table
), which has the same column settings as A_table
has. But the B_table
is empty.
我想要什么:
- 复制从
A_table
到B_table
的每一行.
- Copy every rows from
A_table
toB_table
.
Microsoft SQL Server Management Studio 2012 中是否有任何选项可以从表中创建插入 SQL?或者还有其他选择吗?
Is there any option in Microsoft SQL Server Management Studio 2012, to create an insert SQL from a table? Or is there any other option to do that?
推荐答案
快捷方式:
- 右键数据库
- 指向
tasks
在 SSMS 2017 中,您需要忽略第 2 步 - 生成脚本选项位于上下文菜单的顶层
感谢 Daniel 更新评论. - 选择
生成脚本
- 点击下一步
- 选择表格
- 点击下一步
- 点击高级
- 滚动到
脚本的数据类型
- 在 SMSS 2014 中称为脚本的数据类型
感谢 Ellesedil 用于评论 - 选择
仅数据
- 点击确定"关闭高级脚本选项窗口
- 单击下一步并生成您的脚本
- Right click database
- Point to
tasks
In SSMS 2017 you need to ignore step 2 - the generate scripts options is at the top level of the context menu
Thanks to Daniel for the comment to update. - Select
generate scripts
- Click next
- Choose tables
- Click next
- Click advanced
- Scroll to
Types of data to script
- Calledtypes of data to script
in SMSS 2014 Thanks to Ellesedil for commenting - Select
data only
- Click on 'Ok' to close the advanced script options window
- Click next and generate your script
我通常在这种情况下生成一个新的查询编辑器窗口,然后在需要的地方进行任何修改.
I usually in cases like this generate to a new query editor window and then just do any modifications where needed.
这篇关于如何将表中的所有数据导出为可插入的 sql 格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!