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 <server> /d <database> {[/i] [/p <password>]}
{[/f <script files directory>] [/f <single script file>]}
/q /r /o /t /a /e /c <codepage> /n /x /h /g /y /?
/s - indicates the source server to connect to.
/d - indicates the source database to script.
/i - use integrated security.
/p - password to use for 'sa'. note that login id is always 'sa'.
if /p not used or if a password does not follow the flag,
a null password is used. not compatible with /i.
/f - the directory into which the script files should be generated.
this means one file is generated for each category of objects.
/f - the single file in which all script is to be saved.
not compatible with /f.
/q - use quoted identifiers in the generated scripts.
/r - include drop statements for the objects in the script.
/o - generate oem script files. cannot be used with /a or /t.
this is the default behavior.
/t - generate unicode script files. cannot be used with /a or /o.
/a - generate ansi script files. cannot be used with /t or /o.
/? - command line help.
/e - stop scripting when error occurs.
default behavior is to log the error, and continue.
/c - indicate the codepage which overrides the server codepage.
/n - generate ansi padding.
/x - script sps and xps to separate files.
/h - generate script files without header (default: with header).
/g - use the specified server name as the prefix for the generated
output files(to handle dashes in server name).
/y - generate script for extended properties (valid for 8.x server
only).
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器