是否有免费工具可让您将 MS-SQL Express (2005) 表的数据(而不是结构)作为 INSERT 语句转储到平面文件中?
这个商业产品似乎符合我的想法。我尝试使用SqlDump,但我的完整服务器名称不适合其 SQL Server Name 字段。
你需要做的是
适用于 sql servver 2008 r2。在以前版本的 sql server 中,它类似于您设置为 true 的“脚本数据”。
我认为这对你有用,但你必须为每张桌子运行它。
我知道这不是您的想法,建议的工具看起来很有希望,但如果数据从一个 SQL Server 传输到另一个 SQL Server,则使用bcp是一种低开销的替代方案。下面的重要选项包括用于保留身份信息的 -E 和用于使用本机格式的 -n。执行第一条语句将构建一个批处理文件以将所有数据转储到文件中,第二条语句将创建 bcp ins。
Select 'bcp ' + Table_Catalog + '..' +
Table_Name + ' out ' + Table_Name
+ '.bcp -S ServerName -U userid -P password -n '
from information_schema.tables
where table_type = 'BASE TABLE'
Select 'bcp ' + Table_Catalog + '..' + Table_Name
+ ' in .\' + Table_name +
'.bcp -S .\ -U userid -P password -n -E '
from information_schema.tables
where table_type = 'BASE TABLE'
样本输出
bcp 输出命令
bcp master..tblDepartments out tblDepartments.bcp -S ServerName -U
userid -P password -n
bcp 在命令中
bcp master..tblDepartments in .\tblDepartments.bcp -S .\
-U userid -P password -n -E
试用免费的SSMS 工具包,它是 SSMS 和 SSMS Express 的插件。它使您能够为表、dte 整个数据库或仅为查询结果生成插入脚本。