Solved

SQL - date

Posted on 1998-02-04
4
135 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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