| 導購 | 订阅 | 在线投稿
分享
 
 
 

根據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- 王朝網路 版權所有