June 27, 2003 at 10:18 am
Hy all.
I have this scenario:
Declare @variable numeric(12, 5)
Select @variable = [numeric column] from
where [condition]
/*after this @variable = null*/
if ( @variable is not null )
begin
operation 1
operation 2
end
In this case the operation 1 and operation 2 are executed. If I insert “print @variable” before the “if” statement, operation 1 and operation 2 are not executed.
Can anyone tell me what is going on here?
June 27, 2003 at 10:24 am
Are you saying you print the not-null value and op1 and 2 do not run? Shouldn't be the case.
Steve Jones
June 27, 2003 at 10:37 am
No, I print the null value. Before “if” @variable is null.
I couth SQL Server 2000 SP3 doing this in some situations. I’m stunned, maybe as you are, but I can’t explain this. The same cod is running perfect in other stored procedures, but in some, I have to print the null value so, the if statement will run correctly.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply