将 SQL Server 中的数据导出为 INSERT INTO [英] Exporting data In SQL Server as INSERT INTO

查看:34
本文介绍了将 SQL Server 中的数据导出为 INSERT INTO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SQL Server 2008 Management Studio 并且有一个表我想迁移到不同的数据库服务器.

I am using SQL Server 2008 Management Studio and have a table I want to migrate to a different db server.

是否有任何选项可以将数据导出为插入到 SQL 脚本中?

Is there any option to export the data as an insert into SQL script??

推荐答案

在对象资源管理器的 SSMS 中,右键单击数据库,右键单击并选择任务",然后选择生成脚本".

In SSMS in the Object Explorer, right click on the database, right-click and pick "Tasks" and then "Generate Scripts".

这将允许您为单个或所有表生成脚本,其中一个选项是脚本数据".如果将其设置为 TRUE,向导将为您的数据生成带有 INSERT INTO () 语句的脚本.

This will allow you to generate scripts for a single or all tables, and one of the options is "Script Data". If you set that to TRUE, the wizard will generate a script with INSERT INTO () statement for your data.

如果使用 2008 R2 或 2012 则称为其他名称,请参见下面的截图

选择要编写脚本的数据类型",可以是仅数据"、架构和数据"或仅架构" - 默认).

Select "Types of Data to Script" which can be "Data Only", "Schema and Data" or "Schema Only" - the default).

然后在 Codeplex(包括源代码)上有一个SSMS Addin"包,它几乎承诺相同的功能和更多功能(如快速查找等)

And then there's a "SSMS Addin" Package on Codeplex (including source) which promises pretty much the same functionality and a few more (like quick find etc.)

这篇关于将 SQL Server 中的数据导出为 INSERT INTO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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