Re: Null values blow up my SQL statement - how can I deal with them?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks Bob and John for your replies. I tried what Bob mentioned late yesterday and it seemed to work. But I'm looking at the raw data at the moment and some things got missed. But to quickly answer your question, it is a Date/Time field. This leads to my looking at the raw data now through Access. I guess multiple programs access this table and I see a mix of values in that date field. There are some values with only a date and some with a date and time. Looks like the ones with the time as well gets missed by the Select. Any ideas on how I can get around that? I'm going to continue looking at that right now. Thanks guys.

John B wrote:
Dale wrote:

Hi, I'm looking at some code that opens up a recordset with an SQL Select like below:

SELECT *
FROM InventoryAdjustments
WHERE CDATE(FORMAT(EffectiveDate,"MM/DD/YYYY"))>=#4/10/2005# And CDATE(FORMAT(EffectiveDate,"MM/DD/YYYY"))<=#4/12/2005#


this all works fine until there's some null values in the table for the EffectiveDate field. My SQL is pretty limited, how can I make the above just simply ignore those null values? Thanks.


try this

SELECT <ColList>
FROM <Table>
WHERE EffectiveDate BETWEEN #2005-04-10# AND  #2005-04-12#

I presume that EffectiveDate is defined as a date column?

Formatting date in the manner of yyyy-MM-dd[ HH:mm:ss:nn] removes any ambiguity about the format of the date.
.



Relevant Pages

  • Re: Why many settings arguments dont matter with RAW
    ... John> AKA "dark fram subtraction". ... Well, it has an effect on the raw data, because it *a*ffects the raw data. ... Perhaps your version of English differs. ...
    (rec.photo.digital.slr-systems)
  • Re: Why many settings arguments dont matter with RAW
    ... John> AKA "dark fram subtraction". ... Well, it has an effect on the raw data, because it *a*ffects the raw data. ... My English references all indicate that "effect" can be a ... noun or a verb. ...
    (rec.photo.digital.slr-systems)
  • Re: I need help
    ... John Spencer ... Access MVP 2002-2005, 2007 ... I have a raw data that I download from an application. ... "John W. Vinson" wrote: ...
    (microsoft.public.access.queries)
  • Re: pagefile sys
    ... John wrote: ... >I am trying to find out if there is a way to capture the ... >raw data in the pagefile and create a usable file out of ...
    (microsoft.public.win2000.file_system)
  • Re: Null values blow up my SQL statement - how can I deal with them?
    ... But I'm looking at the raw data at ... it is a Date/Time field. ... I guess multiple programs access this ... FROM InventoryAdjustments ...
    (microsoft.public.vb.general.discussion)