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 /d {[/I] | [/P ]}
{[/F