Subject Re: D2109 - INSERT INTO for a literal date doesn't seem to recognise
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Sun, 2 Mar 2025 21:05:31 -0800
Newsgroups dbase.getting-started

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



--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm