如何获取SQL Server 2008数据库的SQL转储?

时间:2022-09-15 19:51:05

How can I get a SQL dump of a SQL Server 2008 database? That is, a .sql file with inserts to regenerate the data in another database, much like mysqldump.

如何获取SQL Server 2008数据库的SQL转储?也就是说,带有插入的.sql文件可以重新生成另一个数据库中的数据,就像mysqldump一样。

3 个解决方案

#1


55  

From SQL Server Management Studio you can use the Generate Scripts command in the Tasks item of the right-click menu on the target database. From here you generate scripts for the structure and data and SPs etc: make sure 'Script Data' is set to True in the scripting options to get the inserts.

从SQL Server Management Studio,您可以在目标数据库的右键单击菜单的“任务”项中使用“生成脚本”命令。从这里,您可以为结构,数据和SP等生成脚本:确保脚本选项中的“脚本数据”设置为True以获取插入。

#2


10  

Not finding what I needed (scriptable tool dumping SQL statements), I have created a tool called SQL Server Dump which is inspired by mysqldump, but for SQL Server. You will find it at sqlserverdump.codeplex.com

找不到我需要的东西(脚本化工具转储SQL语句),我创建了一个名为SQL Server Dump的工具,它受mysqldump的启发,但对于SQL Server。您可以在sqlserverdump.codeplex.com找到它

#3


8  

I had a hard time finding the 'Script Data' option mentioned in stuartd's answer on SQL Server 2008 R2. I found the 'Types of data to script' option and changed it to 'Schema and Data' and that did the trick

我很难找到stuartd在SQL Server 2008 R2上的答案中提到的“脚本数据”选项。我找到了“脚本数据类型”选项,并将其更改为“架构和数据”,这就是诀窍

#1


55  

From SQL Server Management Studio you can use the Generate Scripts command in the Tasks item of the right-click menu on the target database. From here you generate scripts for the structure and data and SPs etc: make sure 'Script Data' is set to True in the scripting options to get the inserts.

从SQL Server Management Studio,您可以在目标数据库的右键单击菜单的“任务”项中使用“生成脚本”命令。从这里,您可以为结构,数据和SP等生成脚本:确保脚本选项中的“脚本数据”设置为True以获取插入。

#2


10  

Not finding what I needed (scriptable tool dumping SQL statements), I have created a tool called SQL Server Dump which is inspired by mysqldump, but for SQL Server. You will find it at sqlserverdump.codeplex.com

找不到我需要的东西(脚本化工具转储SQL语句),我创建了一个名为SQL Server Dump的工具,它受mysqldump的启发,但对于SQL Server。您可以在sqlserverdump.codeplex.com找到它

#3


8  

I had a hard time finding the 'Script Data' option mentioned in stuartd's answer on SQL Server 2008 R2. I found the 'Types of data to script' option and changed it to 'Schema and Data' and that did the trick

我很难找到stuartd在SQL Server 2008 R2上的答案中提到的“脚本数据”选项。我找到了“脚本数据类型”选项,并将其更改为“架构和数据”,这就是诀窍