自定义函数,获取存储过程参数,可以先参考这篇《sql server information_schema》
set ansi_nulls on go set quoted_identifier on go -- ============================================= -- author: insus.net -- create date: 2019-05-14 -- update date: 2019-05-14 -- description: 获取存储过程参数 -- ============================================= create function [dbo].[tvf_storedprocedureparameter] ( @storedprocedurename sysname ) returns @parameters table ( [parameter name] sysname, [data type] sysname, [length] int, [scale] int, [direction] nvarchar(20) ) as begin insert into @parameters select parameter_name,data_type,isnull(character_maximum_length, numeric_precision),numeric_scale,parameter_mode from information_schema.parameters where specific_schema = 'dbo' and specific_name = @storedprocedurename order by ordinal_position return end go
实例说明: