jdwilcock wrote:Thanks Villeroy. I will be running the sql command directly. This is the statement I am using:
UPDATE "Table1" SET "OrderDate" = CURDATE() ;
Which works fine to poplute all the OrderDate fields with the current date. However, the format is in yyyy-mm-dd. I would like it to be in the mm-dd-yy format. Is there a way to do this with an update query? Even mm-dd-yyyy would be acceptable.
Just as an FYI ( For Your Information ) . . . you did not tell us ( the forum ) the database back-end, product and version, you are using.
You can get this information from the
STATUS BAR at the bottom, after opening your database.
If, you are using the OpenOffice / LibreOffice Embedded Version ( that is HSQL 1.8.0.10 ) . . . then, there is no 'direct' function to do it as you say.
But, if you, for example, you are using the highly recommended
SPLIT DATABASE . . . with . . . HSQL Version
2.3.2 or HSQL Version
2.3.3 . . . then, you, can use the built in function
TO_DATE to convert a text string to a database DATE field.
For example ( various examples

):
Code: Select all
UPDATE "Table1" SET "OrderDate" = TO_DATE('07/02/2015', 'MM/DD/YYYY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07/02/15', 'MM/DD/YY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07-02-2015', 'MM-DD-YYYY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07-02-15', 'MM-DD-YY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07/02/2015', 'DD/MM/YYYY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07/02/15', 'DD/MM/YY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07-02-2015', 'DD-MM-YYYY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07-02-15', 'DD-MM-YY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07.02.2015', 'DD.MM.YYYY') ;
UPDATE "Table1" SET "OrderDate" = TO_DATE('07.02.15', 'DD.MM.YY') ;
Explanation: HSQL 2.3 function
TO_DATE is documented at ( scroll down to find
TO_DATE , and,
Table 10.1 to see the format codes accepted ):
http://www.hsqldb.org/doc/2.0/guide/bui ... _functions
Just thought I would mention it. I hope this helps, please be sure to let me / us know.
Sliderule
Thanks to add
[Solved] in your
1st post Subject (edit button top right) if this issue has been resolved.