Try/Catch check for parameters?

  • I am having problem throwing error when i have to check for parameters that exists in stored proc.

    BEGIN TRY

    IF @parameters IS NULL

    THROW EXCEPTION ---> how can i code here so that it checks for parameter and get caught in catch block if check fails.

    SELeCT a,b c

    from Table1

    END TRY

    BEGIN CATCH

    PRINT 'Error Number:' = ERROR_NUMBER()

    PRINT 'Error Line:' = ERROR_LINE()

    PRINT ERROR_MESSAGE()

    END CATCH

  • Look as the Raiserror() function

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply