I have a stored proc with 2 parameters, both integer
I need to use case statement inside where clause but i could not get it right
where
dbo.StockTransfer.BranchId = @branchId
AND
CASE WHEN IsNumeric(@roleId) = 1
THEN
dbo.StockTransfer.StatusId !=12
ELSE
dbo.StockTransfer.StatusId NOT in (12, 13)
END
order by dbo.StockTransfer.StatusId ASC
I am getting an error in 'dbo.StockTransfer.StatusId !=12'
Msg 102, Level 15, State 1, Procedure GetDeliveryList, Line 44 [Batch Start Line 0]
Incorrect syntax near '!'.