Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to "export" an entire SQL Server database (schema and data) to text?

Tags:

On a per-object basis, SQL Server Management Studio has the option to script the object to clipboard, file, etc. Is there a way (at the database level) to do a "1-click" export of ddl AND data to a text file? Ideally I'd like to select a database and create a big text file containing the ddl for all objects plus the data in all tables. I see the data export wizard (dts/ssis) as a very different thing which really isn't what I'm looking for.

Is this capability available either in SQL Server Management Studio or in the Visual Studio Database Edition?

like image 902
Emilio Avatar asked Feb 12 '10 20:02

Emilio


People also ask

How do you script an entire database?

Right-click the database, point to Tasks, and then select Generate Scripts. In the script wizard, verify that the correct database is selected. Click to select the Script entire database and all database objects, and then select Next.


1 Answers

Yes, in SQL 2008 you can script objects and data.

Right-click on database in Management Studio, Tasks, Generate Scripts ....

Go through the wizard and make sure to check "data" which is false by default.

It is not any easier to find in SQL 2012:

Right-click on database in Management Studio, Tasks, Generate Scripts.
On the "Set scripting options" tab click on Advanced, then select "data only", or "data and schema" for "Types of data to script" (in the General section).

like image 190
cdonner Avatar answered Nov 15 '22 13:11

cdonner