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.
在每个对象的基础上,SQL Server Management Studio可以选择将对象编写为剪贴板,文件等。是否有办法(在数据库级别)将ddl和数据“单击”导出到a文本文件?理想情况下,我想选择一个数据库并创建一个包含所有对象的ddl和所有表中数据的大文本文件。我看到数据导出向导(dts / ssis)是一个非常不同的东西,它真的不是我想要的。
Is this capability available either in SQL Server Management Studio or in the Visual Studio Database Edition?
此功能是在SQL Server Management Studio还是在Visual Studio Database Edition中可用?
1 个解决方案
#1
30
Yes, in SQL 2008 you can script objects and data.
是的,在SQL 2008中,您可以编写对象和数据的脚本。
Right-click on database in Management Studio, Tasks, Generate Scripts ....
在Management Studio,任务,生成脚本中右键单击数据库....
Go through the wizard and make sure to check "data" which is false by default.
完成向导并确保检查默认为“false”的数据。
It is not any easier to find in SQL 2012:
在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).
在Management Studio,Tasks,Generate Scripts中右键单击数据库。在“设置脚本选项”选项卡上,单击“高级”,然后选择“仅数据”,或“数据类型到脚本”的“数据和模式”(在“常规”部分中)。
#1
30
Yes, in SQL 2008 you can script objects and data.
是的,在SQL 2008中,您可以编写对象和数据的脚本。
Right-click on database in Management Studio, Tasks, Generate Scripts ....
在Management Studio,任务,生成脚本中右键单击数据库....
Go through the wizard and make sure to check "data" which is false by default.
完成向导并确保检查默认为“false”的数据。
It is not any easier to find in SQL 2012:
在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).
在Management Studio,Tasks,Generate Scripts中右键单击数据库。在“设置脚本选项”选项卡上,单击“高级”,然后选择“仅数据”,或“数据类型到脚本”的“数据和模式”(在“常规”部分中)。