Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    19

    Unanswered: <> NULL / is not null problem

    I'd like to know what are the differences between <> NULL and is not null in SQL Server

    I have a sp which uses <>NULL syntax to check for not NULL columns but to insert them in a table, but I've noticed that in some cases (some bds and/or servers) it runs ok while in others it fails resulting in a table with no cols inserted (all setted to NULL). I've changed the sp to 'is not null' syntax and now it works properly. What is the reason for this behaviour?

  2. #2
    Join Date
    Mar 2002
    Location
    Bielefeld, Germany
    Posts
    69
    Depends. Normally(ANSI SQL):

    a<>null = null

    whatever a may be. So that does never evaluate to true!

    One can change that behavior with SET ANI_NULLS OFF, than you get

    a<>null = true

    if a is not null and

    a<>null = false

    if a is null.

    HTH,

    chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •