NULL in Not In clause

  • Hi,

    Please look at the follwoing queries.

    1. SELECT ASSETID FROM OARS_USAGE_REPORT WHERE MONTHSTATUS= 1 and assetid is not null

    RecordCount : 3612

    2. SELECT ASSETID FROM OARS_USAGE_REPORT WHERE MONTHSTATUS= 1 and assetid not in (null)

    RecordCount : 0

    Is not in (null) not valid for T-SQL?

    Thanks

  • null = null returns unknown (without returning false, it doesn't return true). So there's just no match found in that query.

  • IS NULL and IS NOT NULL are clauses in the T-SQL, but just NULL is not. If it was u could as well used assetid null. When null is used as comparision it returns non true value.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply