Subject |
Re: D2109 - INSERT INTO for a literal date doesn't seem to recognise |
From |
BRUCE HEATH <sideshow@specsol.com.au> |
Date |
Mon, 03 Mar 2025 00:16:46 -0500 |
Newsgroups |
dbase.getting-started |
Ken Mayer Wrote:
> On 3/2/2025 2:06 PM, BRUCE HEATH wrote:
> > Hi,
> >
> > I'm playing with dBase 2109 and noticed that INSERT INTO seems a bit flaky when loading DATE information.
> >
> > I have a simple rountine that uses INSERT INTO (date_field) VALUES (date_string) and I'm trying to load a date in DD/MM/YY format. Both the Windows 10 system and the Dbase ini file have the date format set to DD/MM/YY
> >
> > e.g.
> > INSERT INTO (fd) VALUES ("27/12/59")
> > This prompts a :Database Engine Error : Type mismatch in expression" error.
> >
> > if I change it to american format e.g.
> >
> > INSERT INTO (fd) VALUES ("12/27/59") //so MM/DD/YY format
> >
> > it goes through without a fault, but I'm wondering why the command fails.
> >
> > It seems as though the command doesn't recognise either the system format or the dBase SET DATE format.
> >
> > When I retrieve the data, however, it's in the "right" format (DD/MM/YY) even though the load in requires MM/DD/YY.
>
> Dates usually must be entered in a year/month/day format for SQL, and
> the INSERT INTO command is local SQL via the BDE, or the current date
> format for your database and dBASE. How is the software supposed to know
> what parts of
>
> What part of either of the three parts of the date is supposed to be the
> day of the month, the month, and the year? It's a good idea to use
> four-digit years, as well. (If you used for your data 25 for the year,
> is that 1925, 2025 ...?)
>
> Try using: 1958/12/27
>
> And see what happens.
>
> Ken
*******************
Thanks Ken,
Appreciate the rapid feedback.
Tried MM/DD/YYYY and that worked fine, so YY or YYYY doesn't seem to make a difference.
Tried YYYY/MM/DD and it threw the same "Database Engine Error : Type mismatch in expression".
Guess I'm stuck with doing it in US format.
Cheers.
|
|