转帖 用SQL语句 查看 某一存储过程 所带参数

SELECT
param.name AS [Name],
ISNULL(baset.name, N'') AS [SystemType],
CAST(CASE WHEN baset.name IN (N'nchar', N'nvarchar') AND param.max_length <> -1 THEN param.max_length/2 ELSE param.max_length END AS int) AS [Length]
FROM
sys.all_objects AS sp
INNER JOIN sys.all_parameters AS param ON param.object_id=sp.object_id
LEFT OUTER JOIN sys.types AS baset ON baset.user_type_id = param.system_type_id and baset.user_type_id = baset.system_type_id
WHERE
(sp.type = N'P' OR sp.type = N'RF' OR sp.type='PC')and(sp.name=
N'这里输入你要查看的过程名称' and SCHEMA_NAME(sp.schema_id)=N'dbo')
ORDER BY
param.parameter_id ASC

 

 后面发现,有此服务器上运行出现,说函数错误,既而找出以下方法:

select b.name,c.name as type,c.length  
from sysobjects a left join syscolumns b on a.id=b.id
left join systypes c on b.xtype=c.xtype
where a.xtype ='P' and
a.id=object_id(N'[dbo].["+proc+"]')";

+proc+就是你自己的存储过程名称

posted @ 2012-10-30 09:30  lanqiaoerp  阅读(87)  评论(0编辑  收藏  举报