Using table variables in T-SQL

  • Comments posted to this topic are about the item Using table variables in T-SQL

  • I must admit I've never seen the construct "IS DISTINCT FROM NULL" before, and initially I thought that must be the error, but it's actually legit. My next thought was that it's a complicated way of saying "IS NOT NULL".

    Actually, it's a bit different. While it doesn't matter for IS NULL / IS NOT NULL, it does make a difference when used with non null values.

    WHERE t.id <> 3 results in 2, whereas WHERE t.id IS DISTINCT FROM 3 results in 3.

    I can think of quite a few cases where this could be a better option than ISNULL().


    Just because you're right doesn't mean everybody else is wrong.

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

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