jueljust 发表于 2006-4-30 10:03:45

请问怎么保存sp_的结果啊?

请问各位大虾,怎么保存sp_XXX之类的系统过程,分类存储过程的结果?比如保存在数据表内,或者赋给变量

ehxz 发表于 2006-5-11 11:15:33

<p>SP有什么结果?存储过程就是标准的TXT文本,存成TXT或SQL就行了,用记事本可以直接打开或编辑。</p>

JohnPhan 发表于 2006-5-11 14:37:31

<p>以sp_help为例子:获得了sp_help的源代码.可以自己分析改造</p><p>sp_helptext sp_help </p><p>/* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */<br/>/*&nbsp;4.8&nbsp;1.1&nbsp;06/14/90&nbsp;sproc/src/help */<br/>/*<br/>** Messages for "sp_help"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 17570<br/>**<br/>** 17460, "Object must be in the current database."<br/>** 17461, "Object does not exist in this database."<br/>** 17570, "Operating System File"<br/>** 17571, "---------------------"<br/>** 17573, "Object is Remote/External"<br/>** 17574, "-------------------------"<br/>** 17575, "Object existed prior to Omni"<br/>** 17576, "Lock scheme is Allpages" <br/>** 17577, "Lock scheme is Datapages"<br/>** 17578, "Lock scheme is Datarows" <br/>** 17579, "Lock scheme Unknown or Corrupted" <br/>** 17581, "Trigger is disabled."<br/>** 17582, "Trigger is enabled."<br/>** 18571, "The attribute '%1!' is not applicable to tables with allpages lock scheme."<br/>*/</p><p>/*<br/>** IMPORTANT NOTE:<br/>** This stored procedure uses the built-in function object_id() in the<br/>** where clause of a select query. If you intend to change this query<br/>** or use the object_id() or db_id() builtin in this procedure, please read the<br/>** READ.ME file in the $DBMS/generic/sproc directory to ensure that the rules<br/>** pertaining to object-id's and db-id's outlined there, are followed.<br/>*/</p><p>create procedure sp_help<br/>@objname varchar(92) = NULL&nbsp;&nbsp;&nbsp;/* object name we're after */<br/>as</p><p>declare @typeid int&nbsp;&nbsp;&nbsp;&nbsp;/* type of object in systyp <br/>es */<br/>declare @sysstat smallint&nbsp;&nbsp;&nbsp;/* the type of the object */<br/>declare @OS_file varchar(255)&nbsp;&nbsp;&nbsp;/* physical file for ext tab */<br/>declare @msg varchar(250)<br/>declare @sptlang&nbsp;int<br/>declare @len1 int, @len2 int, @len3 int, @len4 int, @sysstat2 int<br/>declare @sqltex <br/>t varchar(255)&nbsp;&nbsp;&nbsp;/* SQL to execute using execute<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;** immediate. */</p><p>if @@trancount = 0<br/>begin<br/>&nbsp;set chained off<br/>end</p><p>set transaction isolation level 1</p><p>select @sptlang = @@langid</p><p>if @@langid != 0<br/>begin<br/>&nbsp;if not exists (&nbsp;select * from master.dbo.sysmessages where error<br/>&nbsp;&nbsp;between 17100 and 17109 and langid = @@langid)<br/>&nbsp;&nbsp;&nbsp;&nbsp; select @sptlang = 0<br/>end</p><p>set nocount on<br/>略.</p>
页: [1]
查看完整版本: 请问怎么保存sp_的结果啊?

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com