标题:[求助]可以在存储过程当中将一数据表导出成.SQL文件吗?
只看楼主
albert99
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2005-4-18
 问题点数:0 回复次数:2 
[求助]可以在存储过程当中将一数据表导出成.SQL文件吗?
如题,通过企业管理器将一个表内的数据导出成.SQL文件这个我知道怎样操作,我现在的问题是,我想在存储过程里将某一个表内的某些数据导出到一个.SQL文件里,可以吗?用什么语句?希望知道的朋友告诉一声,非常感谢!
搜索更多相关主题的帖子: SQL文件 企业管理 数据 语句 
2005-04-18 15:24
EA_Games
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:539
专家分:0
注 册:2005-3-13
得分:0 
这个倒没试过,帮你顶住先。

2005-04-18 20:41
EA_Games
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:539
专家分:0
注 册:2005-3-13
得分:0 
找到这样一篇文章,楼主可以参考一下。 MSSQL生成整个数据库的SQL脚本的工具

scptxfr.exe(SQL Server2000自带的升级用的一个工具,一般在SQL安装目录下的Upgrade下)的路径要正确 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).


2005-04-20 20:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-15989-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.055179 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved