Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL - date

Posted on 1998-02-04
4
Medium Priority
?
145 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 100 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

926 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