Home Forums SQL Server 2005 T-SQL (SS2K5) Stored Proc - Nullable Parameters for optional filtering - handling LinkTable LEFT JOINs RE: Stored Proc - Nullable Parameters for optional filtering - handling LinkTable LEFT JOINs

  • Hm - I'm actually kinda surprised that works. I would have thought it would fail because the WHERE condition would evaluate AS

    @TableB_ID IS NULL (TRUE) OR TableB_ID (Value OR NULL) = @TableB_ID (NULL)

    I would have thought that the second part of that would evaluate to undefined, since you are comparing a NULL value with an equals operator. Then, since that one is undefined, the whole condition would evaluate to undefined, since you're ORing TRUE with undefined.

    I guess that the second condition though, will instead evaluate as FALSE instead of undefined, and thus allow it to work?