Unanswered: How to execute SQL code on the condition that a variable is NULL
Hi again =) Have a quick and easy question. I have a query which I am assigning the result of to a local varibale within a stored procedure. I want to then look at the variable and exit the sproc if it is undefined/null.
Here's a snippet
SET @parentId = (SELECT msParentId FROM tblMasterSite WHERE (msId = @root) AND (msRootId <> msParentId))
IF @parentId = ''
The problem is that even when no value is assigned to @parentId the IF statement still doesn't fire. How can I check if @parentId was assigned a value?