日期:2014-05-17 浏览次数:20447 次
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
declare @ProcedureName nvarchar(500);
set @ProcedureName = 'sp_addalias';
exec GetContentByProcedureName @ProcedureName
--select @ProcedureName
sp_helptext ProcedureName
select name from sys.procedures
--or
select name from sysobjects where type='P'
select 'sp_helptext '+name from sysobjects where type='P'