欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

SQL Server INFORMATION_SCHEMA

程序员文章站 2022-09-28 09:50:09
自定义函数,获取存储过程参数,可以先参考这篇《SQL Server INFORMATION_SCHEMA》https://www.cnblogs.com/insus/archive/2010/12/31/1923047.html SET ANSI_NULLS ON GO SET QUOTED_IDE ......

自定义函数,获取存储过程参数,可以先参考这篇《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

 

实例说明: