| 订阅 | 在线投稿
分享
 
 
 

根据SQL存储过程名取得存储过程的内容

来源:互联网  宽屏版  评论
2008-06-01 02:22:50

根据SQL存储过程名取得存储过程的内容:

示例如下:(此语句适用于SQL Server2000/2005)

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_NULLS ON

GO

-- GetContentByProcedureName '[dbo].[存储过程名]'

Create procedure GetContentByProcedureName

(@ProcedureName nvarchar(500))

as

if exists (select * from dbo.syscomments

where id=object_id(N''+@ProcedureName+''))

select c.text, c.encrypted, c.number,

xtype=convert(nchar(2), o.xtype),

datalength(c.text), convert(varbinary(8000),

c.text), 0 from dbo.syscomments c, dbo.sysobjects o

where o.id = c.id and c.id = object_id(N''+@ProcedureName+'')

order by c.number, c.colid option(robust plan)

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO

 
根据SQL存储过程名取得存储过程的内容: 示例如下:(此语句适用于SQL Server2000/2005) SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO -- GetContentByProcedureName '[dbo].[存储过程名]' Create procedure GetContentByProcedureName (@ProcedureName nvarchar(500)) as if exists (select * from dbo.syscomments where id=object_id(N''+@ProcedureName+'')) select c.text, c.encrypted, c.number, xtype=convert(nchar(2), o.xtype), datalength(c.text), convert(varbinary(8000), c.text), 0 from dbo.syscomments c, dbo.sysobjects o where o.id = c.id and c.id = object_id(N''+@ProcedureName+'') order by c.number, c.colid option(robust plan) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO
󰈣󰈤
 
 
 
>>返回首页<<
 
 热帖排行
 
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有