MSSQL生成整个数据库的SQL脚本的工具 scptxfr.exe
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的更多相关文章
- JAVA 自动生成对应数据库表的JPA代码工具
http://blog.csdn.net/zheng2008hua/article/details/6274659 关键词:JPA 数据库表代码自动生成,JPA代码生成 自动生成对应数据库表的 ...
- Excel生成Oracle数据库表sql工具类
1.解决问题: 开发文档中字段比较多的时候,建表sql(Oracle下划线命名规范)比较麻烦,容易出错~~ (主要是懒) 特意手写一个工具,根据excel字段,生成建表的sql语句. ~~~末尾附Gi ...
- mssql sqlserver两条求和sql脚本相加的方法分享
转自:http://www.maomao365.com/?p=7205 摘要: 下文分享两条sql求和脚本,再次求和的方法分享 /* 例: 下文已知两条sql求和脚本,现需对两张不同表的求和记录再次求 ...
- mssql sqlserver 使用SSMS运行sql脚本的六种方法分享
摘要: 下文讲述五种运行sql脚本的方法,如下所示: 实验环境:sql server 2008 R2 在一次会议讨论中,大家咨询我使用SSMS运行sql脚本的方法,下文我将依次举例讲述sql脚本的运行 ...
- 完整备份和差异备份数据库的SQL脚本
工作中需要创建SQL Job对数据库进行定期备份,现把脚本记录如下. 1. 完整备份: -- FULL declare @filename varchar(1024), @file_dev varch ...
- Mysql数据库导出sql脚本
1. 运行环境Centos mysqldump -h localhost -u root -p etv > ./etv.sql etv 是要导出的数据库名 > 设置导出的路径和文件名
- 常用有效检测数据库运行状态SQL脚本
1.查看数据库中不为 InnoDB 引擎的表 SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE FROM information_schema.TABLES W ...
- 【SQL Server 学习系列】-- 随机生成日期时间的SQL脚本
DECLARE @dt1 DATETIME,@dt2 DATETIME,@a BIGINT,@b BIGINT SET @dt1='2010-01-01'--开始日期 SET @dt2='2010-0 ...
- [SQL SERVER] - 还原数据库备份(SQL脚本),抛出 "System.OutOfMemoryException" 异常之解决
背景 在 Microsoft SQL Server 2016 的查询窗体中,直接还原备份数据库的 SQL 脚本(99MB),抛出 Cannot execute script 异常: 原因 相关资料说: ...
随机推荐
- SQL Server 2008 R2 制作数据库结构和数据脚本
数据库中包含众多表和数据,有时候需要创建脚本将表结构和数据一起导出 具体方法如下: 1.右键选择数据库,选择“任务”--->“生成脚本” 2.根据需求,选择制作脚本的对象,一般情况选择“表” 3 ...
- asp.net获取当前页面文件名,参数,域名等方法。统一session验证和权限验证的方法
转:http://blog.csdn.net/llll29550242/article/details/6054323 ASP.net后台获取当前页面的文件名 System.IO.Path.GetFi ...
- Excel通过宏创建百万数据
打开视图->宏->编辑,代码如下,cells(n,m)表示当前Excel表格第n行第m列</span> Sub newdata() Dim i As Long Cells(i, ...
- VS2015连接Oracle数据库(转)
原文地址:https://xuanwo.org/2016/01/03/vs-oracle-11g 开发环境 宿主机:Win10 + VS2015 + ODP.Net for VS2015虚拟机:Win ...
- 开发神器之--Sublime Text
原来还有这么个神器啊,忍痛丢掉了notepad++,投入她的怀抱!! 使用和介绍就不写了,大牛们已经整理了. 官网:http://www.sublimetext.com/ 入门及心得:http://w ...
- ARM学习笔记12——GNU ARM汇编伪操作
1..section 1.1.语法格式 .section section_name[,"flags"[,%type[,flag_specific_arguments]]] 1.2. ...
- usaco 打扫食槽
Description 从前奶牛是不挑食的,但现在世道变了,她们变得非常挑剔.牧场里有N头奶牛,约翰 要向她们提供M种食物,第i头奶牛只会吃Pi号食物. 约翰每天都要打扫食槽,这件事非常累.奶牛沿着食 ...
- 【转】Mac OS X 中 Zsh 下 PATH 环境变量的正确设置
在 Mac OS X 中使用 zsh,环境变量 PATH 一不小心就会变得很紊乱,表现为自己设置的路径总是被放到系统路径之后,部分路径还会有重复.这是我们不太了解 zsh 启动时加载文件的顺序和 Ma ...
- linux下安装php的swoole扩展模块(安装后php加载不出来?)
应开发同事要求,需要安装php的扩展模块swoole.swoole是一种PHP高级Web开发框架,框架不是为了提升网站的性能,而是为了提升网站的开发效率,以最少的性能损耗,换取最大的开发效率. 假设服 ...
- foreach -begin -process -end
gc d:\vm.txt|foreach -begin {write-host "It's beginning."} -process {$_ +"aa"} ...