How can I get a SQL dump of a SQL Server 2008 database?

天涯浪子 提交于 2019-11-30 06:28:57

问题


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.


回答1:


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.




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/1391110/how-can-i-get-a-sql-dump-of-a-sql-server-2008-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!