Is there a way to "export" an entire SQL Server database (schema and data) to text?
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-cl开发者_StackOverflow社区ick" 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?
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).
精彩评论