获取存储过程创办脚本的参数部分
获取存储过程创建脚本的参数部分CREATE PROC P_TEST@pro VARCHAR(20),--注释@Pro2 VARCHAR(20),@ASNUm
获取存储过程创建脚本的参数部分
CREATE PROC P_TEST
@pro VARCHAR(20),--注释
@Pro2 VARCHAR(20)='',
@ASNUm INT
AS
SELECT * from Table1 where pro=@pro And @pro2=@pro2 and ASNum=@ASNum
有这样的一个存储过程,如何获取到As前边的那一段文字呢?
结果:
CREATE PROC P_TEST
@pro VARCHAR(20),--注释
@Pro2 VARCHAR(20)='',
@ASNUm INT
AS
[解决办法]create table #(id int identity(1,1),txt nvarchar(1000))
insert into #(txt)
exec sp_helptext 'P_TEST'
go
select * from # where id=2
[解决办法]CREATE PROC P_TEST
@pro VARCHAR(20),--注释
@Pro2 VARCHAR(20)='',
@ASNUm INT
AS
begin
select @pro,@pro2,@asnum
end
go
declare @tb table(id int identity(1,1),txt nvarchar(1000))
declare @col nvarchar(1000)
insert into @tb(txt)
exec sp_helptext 'P_TEST'
select @col=isnull(@col+' ','')+txt from @tb where id<=(select id from @tb where txt like 'AS%')
select @col
/*
----------------------------------------------------------------------------------------------------------------
CREATE PROC P_TEST
@pro VARCHAR(20),--注释
@Pro2 VARCHAR(20)='',
@ASNUm INT
AS
(1 行受影响)
*/
go
drop procedure p_test