Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL - date

Posted on 1998-02-04
4
Medium Priority
?
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

722 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