Solved

SQL - date

Posted on 1998-02-04
4
133 Views
Last Modified: 2010-04-04
Why does the following reports 'mismatch is expression':

select * from customers
where customers.'entry date' < '01-01-1998'
0
Comment
Question by:lagen004
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1358260
hi lagen004,

SELECT *
FROM customers
WHERE customers.'entry date' < {TDateTime = Integer}

You must give an integer value, not a string value, because dates or in TDateTime formats. You get the TDateTime format of '01-01-1998' by calling StrToDate('01-01-1998') or StrToDateTime()

Regards,
Zif.

0
 

Expert Comment

by:buliang
ID: 1358261
try following

SELECT * FROM customers
WHERE customers.'entry date' < '1-jan-1998'

this may work under bde3.0 and higher
0
 
LVL 1

Expert Comment

by:RJENKINS
ID: 1358262
SQL needs a specific format for Dates

'MM/DD/YYYY' , 'MM/DD/YY' or 'dd-MMM-YYYY'

SELECT * FROM customers
WHERE customers.'entry date' < "01/01/1998"

For ZifNab:- TDateTime is Float NOT and Integer

and what you have written is not a legal SQL statement.

RCJ


0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358263
RJENKINS, correct about integer, my mistake, it's double.
and pardon me, it worked in my test program.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now