How to export all data from table to an insertable sql format?(如何将表中的所有数据导出为可插入的 sql 格式?)
问题描述
我在 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_tabletoB_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
tasksIn SSMS 2017 you need to ignore step 2 - the generate scripts options is at the top level of the context menuThanks 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 scriptin 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 格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将表中的所有数据导出为可插入的 sql 格式?
基础教程推荐
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
