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).

MSSQL生成整个数据库的SQL脚本的工具 scptxfr.exe的更多相关文章

  1. JAVA 自动生成对应数据库表的JPA代码工具

    http://blog.csdn.net/zheng2008hua/article/details/6274659 关键词:JPA 数据库表代码自动生成,JPA代码生成     自动生成对应数据库表的 ...

  2. Excel生成Oracle数据库表sql工具类

    1.解决问题: 开发文档中字段比较多的时候,建表sql(Oracle下划线命名规范)比较麻烦,容易出错~~ (主要是懒) 特意手写一个工具,根据excel字段,生成建表的sql语句. ~~~末尾附Gi ...

  3. mssql sqlserver两条求和sql脚本相加的方法分享

    转自:http://www.maomao365.com/?p=7205 摘要: 下文分享两条sql求和脚本,再次求和的方法分享 /* 例: 下文已知两条sql求和脚本,现需对两张不同表的求和记录再次求 ...

  4. mssql sqlserver 使用SSMS运行sql脚本的六种方法分享

    摘要: 下文讲述五种运行sql脚本的方法,如下所示: 实验环境:sql server 2008 R2 在一次会议讨论中,大家咨询我使用SSMS运行sql脚本的方法,下文我将依次举例讲述sql脚本的运行 ...

  5. 完整备份和差异备份数据库的SQL脚本

    工作中需要创建SQL Job对数据库进行定期备份,现把脚本记录如下. 1. 完整备份: -- FULL declare @filename varchar(1024), @file_dev varch ...

  6. Mysql数据库导出sql脚本

    1. 运行环境Centos mysqldump -h localhost -u root -p etv > ./etv.sql etv 是要导出的数据库名 > 设置导出的路径和文件名

  7. 常用有效检测数据库运行状态SQL脚本

    1.查看数据库中不为 InnoDB 引擎的表   SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE   FROM information_schema.TABLES  W ...

  8. 【SQL Server 学习系列】-- 随机生成日期时间的SQL脚本

    DECLARE @dt1 DATETIME,@dt2 DATETIME,@a BIGINT,@b BIGINT SET @dt1='2010-01-01'--开始日期 SET @dt2='2010-0 ...

  9. [SQL SERVER] - 还原数据库备份(SQL脚本),抛出 "System.OutOfMemoryException" 异常之解决

    背景 在 Microsoft SQL Server 2016 的查询窗体中,直接还原备份数据库的 SQL 脚本(99MB),抛出 Cannot execute script 异常: 原因 相关资料说: ...

随机推荐

  1. 汉企C#面向对象——继承

    public class Shengwu { private string _Name; public string Name { get { return _Name; } set { _Name ...

  2. [FJSC2014]圈地

    [题目描述] 2维平面上有n个木桩,黄学长有一次圈地的机会并得到圈到的土地,为了体现他的高风亮节,他要使他圈到的土地面积尽量小.圈地需要圈一个至少3个点的多边形,多边形的顶点就是一个木桩,圈得的土地就 ...

  3. ARC模式下的单例写法

    // 单例 + (id)sharedInstance { __strong static id sharedObject = nil; static dispatch_once_t onceToken ...

  4. Unity给力插件之ShaderForge(一)

    这是一个用来制作shader的插件,也是一个很好的学习shader的工具.这个插件上手很容易,但是要用它来制作理想的Shader,需要下点功夫. 这儿先列举出基础知识,以及我的一些实践.以后我还会继续 ...

  5. Red5 项目的流事件回调流程和注意事项

    回调流程 参考:Red5的一般客户端连接各个事件的触发顺序,经验证实际过程如下: 程序开始(在RED5启动的时候会自动去启动APP,从而触发以上事件) Start:MyChatRoomappStart ...

  6. JavaScript高级程序设计55.pdf

    输入模式 HTML5为文本字段新增了pattern属性,这个属性的值是一个正则表达式,用于匹配文本框中的值 例如,只想在允许在文本字段中输入数值 <input type="text&q ...

  7. C语言调用汇编实现字符串对换

    1. 前面配置arm交叉编译环境. 2. 配置好qemu-arm C语言代码string-switch.c: #include <stdio.h> #include <stdlib. ...

  8. 用C++的类做三种优先队列的实现

    学过数据结构的都知道优先队列这种东西,普通的队列是依据入队顺序,先入队的先出队,而优先队列则是依照键值,键值越大(或越小),就越先出队. 所以,优先队列基本支持push,pop,empty,size, ...

  9. HDU 1568 Fibonacci 数学= = 开篇

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1568 分析:一道数学题 找出斐波那契数列的通项公式,再利用对数的性质就可得到前几位的数 斐波那契通项公 ...

  10. RDD.scala(源码)

    ---- map. --- flatMap.fliter.distinct.repartition.coalesce.sample.randomSplit.randomSampleWithRange. ...