Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump equivalent for SQL Server

Tags:

Is there an equivalent schema & data export/dumping tool for SQL Server as there is for MySQL with mysqldump. Trying to relocate a legacy ASP site and I am way out of happy place with working on a windows server.

Note: The DTS export utility own seems to export data, without table defs. Using the Enterprise Manager and exporting the db gets closer with exporting the schema & data... but still misses stored procedures.

Basically looking for a one does it all solution that grabs everything I need at once.

like image 808
David Avatar asked Sep 17 '08 16:09

David


People also ask

Does Mysqldump create database?

Mysqldump is a command-line utility that is used to generate the logical backup of the MySQL database. It produces the SQL Statements that can be used to recreate the database objects and data. The command can also be used to generate the output in the XML, delimited text, or CSV format.

Does Mysqldump drop database?

If you want to cause the dump file to force a drop of each database before recreating it, use the --add-drop-database option as well. In this case, mysqldump writes a DROP DATABASE statement preceding each CREATE DATABASE statement.

How do I export data from MySQL to mssql?

On the File menu, select New Project. Enter the project name and a location to save your project and the migration target. Then select SQL Server in the Migrate To option. In the Connect to MySQL dialog box, enter connection details, and then connect to your MySQL server.

Why Mysqldump is not working?

If mysqldump is not identified by the cmd prompt that means it cannot recognize where the mysqldump.exe is located. You need to add path of the directory where the exe is located in the PATH variable under environment variables. After doing that your command will start working in the cmd prompt.


1 Answers

To do this really easily with SQL Server 2008 Management Studio:

1.) Right click on the database (not the table) and select Tasks -> Generate Scripts

location of tool

2.) Click Next on the first page

3.) If you want to copy the whole database, just click next. If you want to copy specific tables, click on "Select Specific Database Objects", select the tables you want, and then click next.

4.) "Save to File" should be selected. IMPORTANT: Click the Advanced button next to "Save to File", find "Types of data to script", and change "Schema only" to "Schema and data" (if you want to create the table) or "Data only" (if you're copying data to an existing table).

adding data to the script

5.) Click through the rest and you're done! It will save as a .sql file.

like image 166
dallin Avatar answered Sep 28 '22 11:09

dallin