Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 522
pupeno Avatar asked Sep 07 '09 22:09

pupeno


People also ask

How do I export a database in SQL Server 2008?

Right click on your database and hover on Tasks, you got another dropdown, Select Back Up. You got a pop-up like this. Click on OK button. You got your exported database.

How do I find the dump file in SQL Server?

Open SQL Server Configuration Manager. Under SQL Server Services, locate the SQL Server under investigation. Right-click it, select Properties and go to the Advanced tab. Modify that Dump Directory to the desired path and select OK.

How do you do a SQL dump?

To generate a dump select the database or table in the Object Browser and select Database -> Backup/Export -> Backup Database As SQL Dump… This option is also available in Table -> Backup/Export -> Backup Database As SQL Dump... or just press Ctrl+Alt+E.


2 Answers

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.

like image 65
stuartd Avatar answered Oct 02 '22 03:10

stuartd


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 on github

like image 38
Daniel Avatar answered Oct 02 '22 03:10

Daniel