登陆 免费注册 提交网站
站长资讯 >> 站长学院 >> 数据库类
 2008-03-30 22:56浏览: 2981 次

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

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

[code]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[/code]

网站首页 - 关于我们 - 联系我们 - 友情链接 - 帮助中心
Copyright ©2007-2022 www.Aisila.com All Rights Reserved
苏ICP备20008864号-4