T-SQL - function with default parameters

前端 未结 4 2045
傲寒
傲寒 2020-11-27 14:45

I have this script:

CREATE FUNCTION dbo.CheckIfSFExists(@param1 INT, @param2 BIT = 1 )
RETURNS BIT
AS
BEGIN
    IF EXISTS ( bla bla bla )
        RETURN 1;
          


        
4条回答
  •  广开言路
    2020-11-27 14:53

    One way around this problem is to use stored procedures with an output parameter.

    exec sp_mysprocname @returnvalue output, @firstparam = 1, @secondparam=2

    values you do not pass in default to the defaults set in the stored procedure itself. And you can get the results from your output variable.

提交回复
热议问题