just curious

  • hi

    this is just question to know.

    in my cursor i am giving condition like(@maxdate =null)

    it was not working

    but if do (@maxdate is null)

    that was working.

    what is different between them.

    @maxdate is datetime param

  • LIKE

    Equals (=)

    Both are used for comparisons.

    This makes no sense:

    = (@maxdate = null)

    And neither does what you tried to do:

    like (@maxdate = null)

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • You need to use IS NULL or IS NOT NULL when checking for a null value. You need to remember the null = null is NOT true. Also null <> null is NOT true.

  • I guess the OP wants to know why NULL cannot be used with = operator but can be used with the keyword IS

    Riya_dave, it depends on SET ANSI_NULL setting of your database

  • ColdCoffee (4/27/2012)


    I guess the OP wants to know why NULL cannot be used with = operator but can be used with the keyword IS

    Riya_dave, it depends on this setting of your database

    Not making any assumptions here.

  • Lynn Pettis (4/27/2012)


    ColdCoffee (4/27/2012)


    I guess the OP wants to know why NULL cannot be used with = operator but can be used with the keyword IS

    Riya_dave, it depends on this setting of your database

    Not making any assumptions here.

    Thats why i guessed it 😎 And OP is one confused(ing) person wrt SQL, IIRC.

  • got clear now.

    thanks,thats what i wanted to know

  • Lynn Pettis (4/27/2012)


    ColdCoffee (4/27/2012)


    I guess the OP wants to know why NULL cannot be used with = operator but can be used with the keyword IS

    Riya_dave, it depends on this setting of your database

    Not making any assumptions here.

    It may be petulent, but I am just returning the favor on the answers I give to the contrived questions from this particular poster. It's as if this is someone playing a game with us.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • opc.three (4/27/2012)


    Lynn Pettis (4/27/2012)


    ColdCoffee (4/27/2012)


    I guess the OP wants to know why NULL cannot be used with = operator but can be used with the keyword IS

    Riya_dave, it depends on this setting of your database

    Not making any assumptions here.

    It may be petulent, but I am just returning the favor on the answers I give to the contrived questions from this particular poster. It's as if this is someone playing a game with us.

    Just remember, he isn't showing us actual code.

  • Lynn Pettis (4/27/2012)


    Just remember, he isn't showing us actual code.

    He? the names sounds like a SHE :-D. Whats your take ?

    {Lets, for fun, hijack this thread :-P}

  • ColdCoffee (4/27/2012)


    Lynn Pettis (4/27/2012)


    Just remember, he isn't showing us actual code.

    He? the names sounds like a SHE :-D. Whats your take ?

    {Lets, for fun, hijack this thread :-P}

    I use the pronoun he in the generic sense (instead of he/she or s/he), until otherwise corrected. For instance, when someone refers to me in the female gender I quickly correct them as I am a male.

  • Lynn Pettis (4/27/2012)


    ColdCoffee (4/27/2012)


    Lynn Pettis (4/27/2012)


    Just remember, he isn't showing us actual code.

    He? the names sounds like a SHE :-D. Whats your take ?

    {Lets, for fun, hijack this thread :-P}

    I use the pronoun he in the generic sense (instead of he/she or s/he), until otherwise corrected. For instance, when someone refers to me in the female gender I quickly correct them as I am a male.

    Totally.. I just wanted to make this thread light 😉

  • ...on second thought...comment removed...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • opc.three (4/27/2012)


    ...on second thought...comment removed...

    Dang, had three minutes to see what you said and I missed it. 😛

  • Lynn Pettis (4/27/2012)


    opc.three (4/27/2012)


    ...on second thought...comment removed...

    Dang, had three minutes to see what you said and I missed it. 😛

    Yeah...for once I need to stop violating my rule about posting junk late on a Friday afternoon 😀

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 15 posts - 1 through 15 (of 25 total)

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