--只适合2000,注意路径(文件夹名称带空格必须使用" "引起来)
--(scptxfr.exe的路径要正确)
declare @cmd varchar(1000)
set @cmd = 'master.dbo.xp_cmdshell ' +
'''c:\"Program Files"\"Microsoft SQL Server"' +
'\MSSQL\Upgrade\scptxfr.exe ' +
' /s YourServerName /p YourSAPassword /I /d YourDBName /f ' +
'c:\YourDBName.sql'''
exec (@cmd)
--(scptxfr.exe的路径要正确)
declare @cmd varchar(1000)
set @cmd = 'master.dbo.xp_cmdshell ' +
'''c:\"Program Files"\"Microsoft SQL Server"' +
'\MSSQL\Upgrade\scptxfr.exe ' +
' /s YourServerName /p YourSAPassword /I /d YourDBName /f ' +
'c:\YourDBName.sql'''
exec (@cmd)