PDA

View Full Version : Need help with an UPDATE QUERY


DB.Fun
02-21-03, 13:27
Version: Corel Paradox 8

Personal Background: I have a few years of experience programming on client-side applications and SQL DBs, however I am new to Corel Paradox and I need help.

Situation:

I am trying to enhance a script file that is part of an existing application. I need to update one table based upon data in another table. In particular, I need to update an Alpha field in a table with the string equivalent of a date field in another table. The goal is to have the date value stored as a string in YYYYMMDD format.

Below I have provided a snippet of the code. My quess is that format() is not accessible in a query.

Thank you in advance,
DB.Fun

Sample Code:

var
qry query
endvar

qry = query

Table1.db | T1Col1 | T1Col2 |
| _join1 | _T1Col2 |

Table2.db | T2Col1 | T2Col2 |
| _join1 | .., changeto format("DY3M2D2O(%y%m%d)", _T1Col2) |

endquery
executeqbe(qry)

Where:

Table: Table1.db
Field: T1Col1
Datatype: Alpha

Field: T1Col2
Datatype: Date

Table: Table2.db
Field: T2Col1
Datatype: Alpha

Field: T2Col2
Datatype: Alpha

Shores
08-27-03, 18:04
You can do it by two queries:

With the first one you translate the date to three alpha fields using the Year() Month() Day() functions, then use another query to bring them together in one string, or even do it in one pass...