其他分享
首页 > 其他分享> > 获取存储过程参数

获取存储过程参数

作者:互联网

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

 

实例说明:

 

标签:SYSNAME,存储,dbo,NUMERIC,获取,参数,GO,SCHEMA
来源: https://www.cnblogs.com/insus/p/10862113.html