silverkid
silverkid

Reputation: 9563

MSAccess: type mismatch in date column for sql query

In ms-access database i have a table named tableA

this table has a column called Call_Date which has 4 types of entries

  1. dates ( e.g 10/23/2008 )
  2. -
  3. NA
  4. Blanks ( empty cell )

how can i write a query to select all rows of tableA except those where the Call_Date column has - or NA or Blanks

i tried writing

Select * from tableA where Call_Date not in ('-','NA',' ');

but its giving type mismatch error.

Upvotes: 0

Views: 381

Answers (2)

shahkalpesh
shahkalpesh

Reputation: 33476

I am assuming that Call_Date must be string type in the table.

Select * from tableA where IsDate(Call_Date) = true

Upvotes: 1

keith
keith

Reputation: 3110

You could try casting the Call_Date field as a string

Select * from tableA where Cstr(Call_Date) not in ('-','NA',' ');

Although I would think the datatype of Call_Date should be string if it can have all those entries

Upvotes: 0

Related Questions