MSSQL生成整个数据库的SQL脚本的工具


scptxfr.exe的路径要正确
declare @cMd varchar(1000)
set @cmd = 'master.dbo.xp_cmdshell ' +
'''c:"Microsoft ' +
'SQL Server"' +
'\MSSQL\Upgrade\scptxfr.exe ' +
' /s YourServerName /p YourSAPassword /I /d YourDBName /f ' +
'c:\YourDBName.sql'''
exec (@cmd)

工具参数说明:
SCPTXFR /s

1<server> /d <database> {[/I] | [/P <password>]}   
2{[/F <script directory="" files=""></script></password></database></server>
Published At
Categories with 数据库类
comments powered by Disqus