Results 1 to 11 of 11
  1. #1
    Join Date
    Aug 2006
    Location
    Leeds, UK
    Posts
    104

    Unanswered: mssql won't find NULL values in datetime field??

    Hi

    I have a really simple query which i can't figure out why its not working. I have a table called 'ADMIN' which has a datetime field called 'date_edited'. Because the majority of records have never been edited, i have allowed null values and they are filled with 'NULL' in each record. How ever, when i try:

    SELECT * FROM ADMIN WHERE date_edited = NULL

    I get no records, but i can see and know i have hundreds! I know i'm doing somthing really stupid, but for life of me can't figure it out!

    thanks

  2. #2
    Join Date
    Aug 2006
    Location
    Leeds, UK
    Posts
    104
    ignore me, found the answer

    SELECT * FROM ADMIN WHERE date_edited is NULL

  3. #3
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    Consider yourself ignored.

    -- This is all just a Figment of my Imagination --

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I'm ignoring him right now. Intensely.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Oct 2006
    Posts
    115
    please dun treat newbies like that, we all started off as a newbie right?

    maybe we shall have a newbie section for them to post elementary questions....

    but seriously, this NULL question does look dumb.......TS shall try harder before posting it.......

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    personally I still hate nulls and three part logic. It causes problems for so many programmers. I slap as many not null constraints in my software as I can. Of course I spend so much time fighting fires these days, I only get to do reactive development or redevelopment.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  7. #7
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    ROTFL ... look at Sean's title in the above post ... i almost missed that.

    Another contradictory Seanism

    -- This is all just a Figment of my Imagination --

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Declare @ZenosParadox varchar(50)
    Set @ZenosParadox = 'This value is null'
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  9. #9
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    I learned in math class that zeno's paradox was that you could never reach any destination because you first had to travel 1/2 the distance, then 1/2 again, then again, so you'd never reach it.

    poor zeno didn't know an infinite series can sum to a finite number.

  10. #10
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002

  11. #11
    Join Date
    Oct 2006
    Posts
    115
    NULL value is good, I dun need to be bothered about putting constraint while showing them on a report hehe...

Posting Permissions

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