获取存储过程参数

自定义函数,获取存储过程参数,可以先参考这篇《SQL Server INFORMATION_SCHEMAhttps://www.cnblogs.com/insus/archive/2010/12/31/1923047.html

 

获取存储过程参数

 

获取存储过程参数
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
Source Code

 

实例说明:

获取存储过程参数

 

上一篇:PostgreSQL-12-数据导入与导出


下一篇:warning: a non-numeric value encountered in line *的解决方法