Results 1 to 2 of 2

Thread: query for 'null' in a date column-how?

  1. #1
    Judith Farber Abraham Guest

    query for 'null' in a date column-how?

    I know I am missing something basic, here.
    I have a date field in a table. The field is 'allowed Nulls'. When a certain thing happens in the program, the date is filled in.
    At various times, I need to do a query to find all the rows that have no dates entered.

    What do I use in my where clause? SQL server does not like 'where date = null.'

    Thanks,
    Judith


  2. #2
    Kenneth Wilhelmsson Guest

    query for 'null' in a date column-how? (reply)

    It depends on the ANSI compliance settings on the server. By default SQL Server allows ' = NULL', but this is not
    ANSI compliant and will break if this setting changes on the server.
    (Maybe it's settable per connection, I don't remember offhand)

    The preferred way is to use the keywords IS NULL or IS NOT NULL.

    /Kenneth

    ------------
    David E. Pierri at 4/19/99 2:04:21 PM

    I ran a query on a table I have where dates can me null (inventory table) and the select * from thetable where thedate = null works fine
    with me. You must use the column name exactly as it is listed on your structure, specially if your server is case sensitive.

    Good luck.
    David

    ------------
    Judith Farber Abraham at 4/19/99 7:39:54 AM

    I know I am missing something basic, here.
    I have a date field in a table. The field is 'allowed Nulls'. When a certain thing happens in the program, the date is filled in.
    At various times, I need to do a query to find all the rows that have no dates entered.

    What do I use in my where clause? SQL server does not like 'where date = null.'

    Thanks,
    Judith


Posting Permissions

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