1

In my procedure i am returning a int value.

ALTER PROCEDURE [dbo].[GetValue] 
    -- Add the parameters for the stored procedure here
    @ID int,

AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    DECLARE @isNew int
    SET @isNew=0
    DECLARE @returnedValue int
    DECLARE @output int
    SET @returnedValue=[dbo].fn_GetIsNewLecturer(@ID)


    IF(@returnedValue=0)        
        BEGIN
             PRINT 'new'
             EXEC @output=[dbo].[GetNew] @ID
             SELECT @output 
        END
    ELSE
        BEGIN
            PRINT 'old'
            EXEC @output=[dbo].[sp_GetOld] @ID
            SELECT @output  
        END
        RETURN @output
END

it return value should be int. But it returns Nullable int?. how to change it as int enter image description here

1 Answer 1

1

Try this:

select [Output] = isnull(@output, 0)

Here's why it should work:

declare @i int

select ni = @i, nni = isnull(@i,0)
into #t

select is_nullable, * 
from tempdb.sys.columns 
where [object_id] = object_id(N'tempdb..#t')

drop table #t
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.