I have a stored procedure being called from an .aspx.cs page. I have a parameter that sometimes cannot be sent when the sproc is called. Because of this I'm doing the following:
IF @variable is null
BEGIN
...do this...
END
Else
...do that...
My problem is in the IF statement. As far as I can tell when I use any of the following:
if @parameterVariable = nullif @parameterVariable = ''if @parameterVariable <= 0
Nothing happens!? When I debug the sproc in SSMS I find that (even though the parameter is empty (no user selection)) that the cursor goes to and runs the code in the ELSE statement. Am I doing something wrong?
Thanks!
@parameterVariableactuallynull?Declare @variableandset @variable = nullTypically however the parameter will contain a value. However I found and am correcting the sproc to manage when the user doesn't make the selection and the parameter isn't defined.NULL(except forIS NULL) result inunknownnottrueorfalse. Read up on three valued logic.