Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > ADP及SQL SERVER

获取SQL SERVER某个数据库中所有存储过程的参数

时 间:2017-12-13 08:21:17
作 者:宏鹏   ID:21115  城市:上海
摘 要:获取SQL SERVER某个数据库中所有存储过程的参数
正 文:

一、获取指定数据库中所有存储过程的参数的方法

Select sp.object_Id as FunctionId, sp.name as FunctionName,
            isnull(param.name,'')as ParamName,isnull(usrt.name,'') AS [DataType],
            ISNULL(baset.name, '') AS [SystemType], CAST(CASE when baset.name is null then 0  WHEN baset.name IN ('nchar', 'nvarchar') AND param.max_length <> -1 THEN param.max_length/2 ELSE param.max_length END AS int) AS [Length],
            '' as ParamReamrk,isnull(parameter_id,0) as SortId
            FROM sys.objects AS sp  INNER JOIN sys.schemas b ON sp.schema_id = b.schema_id
            left outer JOIN sys.all_parameters AS param ON param.object_id=sp.object_Id
            LEFT OUTER JOIN sys.types AS usrt ON usrt.user_type_id = param.user_type_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) or ((baset.system_type_id = param.system_type_id) and (baset.user_type_id = param.user_type_id) and (baset.is_user_defined = 0) and (baset.is_assembly_type = 1)) 
           LEFT OUTER JOIN sys.extended_properties E ON sp.object_id = E.major_id
            Where sp.TYPE in ('FN', 'IF', 'TF','P')  AND ISNULL(sp.is_ms_shipped, 0) = 0 AND ISNULL(E.name, '') <> 'microsoft_database_tools_support'
            orDER BY sp.name,param.parameter_id ASC

二、实例

查询SQL SERVER 系统数据库 master 中的所有存储过程参数









Access软件网QQ交流群 (群号:54525238)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助