Solved

SQL - date

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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