I have this stored procedure:
CREATE PROCEDURE [dbo].[get_test_status]
@CreatedBy INT OUTPUT,
@TestStatusId INT OUTPUT,
@UserTestId INT,
@UserId INT
AS
How can I throw an error if the @UserId parameter is a null or zero ?
Here's what I tried but it gives a syntax error:
IF (@UserId = 0 OR @UserId IS NULL)
THROW 70001, "UserId: Cannot be zero or null" , 1