NULL values handled differently in stored procedure

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Mike (anonymous_at_discussions.microsoft.com)
Date: 10/04/04


Date: Mon, 4 Oct 2004 12:26:35 -0700

Can someone explain why the following is happening:

SELECT EventId, MDResponse FROM tblEvent
WHERE (MDResponse NOT IN(1, 3))
ORDER BY MDResponse

If I run the above statement in Query Analyzer it returns
all rows where MDResponse is not 1 or 3. No NULL
MDResponse rows are returned. This is what I expected.

If I run it as a stored procedure it also returns the
NULL valued rows.

Why the difference?

Thanks
Mike