[英]How to export data from SQL Server 2008.2010 in DML (SQL script)?
Is there a tool or special query to do that. 有没有工具或特殊查询来做到这一点。 I'm not an database administrator.
我不是数据库管理员。
Here are the steps to generate the scripts from a database along with data. 以下是从数据库生成脚本以及数据的步骤。 The screenshots were taken using
SQL Server 2012 Management Studio
but I believe that the steps are similar for SQL Server 2008 as well. 截图是使用
SQL Server 2012 Management Studio
拍摄的,但我相信SQL Server 2008的步骤也是类似的。
Tasks --> Generate Scripts...
Tasks --> Generate Scripts...
”选项Tasks --> Generate Scripts...
Next
button. Next
按钮。 Script entire database and all database objects
checked. Script entire database and all database objects
检查了Script entire database and all database objects
。 You can also select the option Select specific database objects
and pick the objects of your choice. Select specific database objects
选项并选择您选择的对象。 Advanced
button. Advanced
按钮。 Types of data to script
. Types of data to script
”选项。 By default, this is set to Schema only
, which means it will generate only the create object statements. Schema only
,这意味着它将仅生成create object语句。 If you want both object creation script along with data, select the option Schema and data
. Schema and data
”选项。 Click OK on the Advanced Scripting Options dialog and click Next on the Set Scripting Options step Scripting the entire AdventureWorks database turned to be a huge 522 MB
script file! 脚本整个AdventureWorks数据库变成了一个巨大的
522 MB
脚本文件!
Hope that helps. 希望有所帮助。
Do you mean generating data script? 你的意思是生成数据脚本吗? If it is so then simply right click on the database name -Generate Scripts.
如果是这样,那么只需右键单击数据库名称-Generate Scripts。 In the advanced option in the wizard you get to choose "Type Of data script to add".
在向导的高级选项中,您可以选择“要添加的数据类型脚本”。 Select data only there and you can get the data script
只在那里选择数据,您就可以获得数据脚本
to what format? 什么格式? are you only referring to 1 table or the whole database?
你只是指1个表还是整个数据库?
if you are exporting to an excel file from 1 table then all you have to do is run a sql query statement to display all records then highlight all rows thru clicking on the top most right space of the grid and right click copy with column headers. 如果要从1个表导出到excel文件,那么您所要做的就是运行sql查询语句以显示所有记录,然后通过单击网格的最右上方空间突出显示所有行,并右键单击带有列标题的复制。
open excel and paste. 打开excel并粘贴。
should be good to go. 应该好好去。
Have you tried using SSMS tool pack ? 您是否尝试过使用SSMS工具包 ? It is one of the best addins for SSMS.
它是SSMS最好的插件之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.