Bizarre WHERE col = NULL behavior

Posted by Kenneth on Stack Overflow See other posts from Stack Overflow or by Kenneth
Published on 2010-04-08T20:21:58Z Indexed on 2010/04/08 20:23 UTC
Read the original article Hit count: 252

Filed under:

This is a problem one of our developers brought to me. He stumbled across an old stored procedure which used 'WHERE col = NULL' several times. When the stored procedure is executed it returns data.

If the query inside the stored procedure is executed manually it will not return data unless the 'WHERE col = NULL' references are changed to 'WHERE col IS NULL'.

Can anyone explain this behavior?

© Stack Overflow or respective owner

Related posts about sql-server