Using QMF

U. -- Update a row in a table

To update one or more values in an existing row of a table, put the operator U., with the new value, in each column you want to change. An example table that uses U. can have more than one row. However, all rows must contain the U. operator. Values in other columns identify the row or rows to change.

You can update rows in a table that you created or in a copy of a table someone else created. (You need authorization to create or copy a table.) For example, to copy the Q.STAFF sample table, enter DISPLAY Q.STAFF. When Q.STAFF displays, enter SAVE DATA AS PERS. The examples that use U. assume that you created (or copied) a table and called it PERS.

This query updates the PERS table for employees 250 and 330. It changes data in the JOB column to SALES and increases salary by 15%.



PERS | ID   | JOB      | SALARY | SALARY      |
-----+------+----------+--------+-------------|
     | 250  | U. SALES | _S1    | U. _S1*1.15 |
     | 330  | U. SALES | _S2    | U. _S2*1.15 |

To see the changed rows in your PERS table, enter DISPLAY PERS. The updated PERS table should look like this:

    ID  NAME       JOB        SALARY
------  ---------  -----  ----------
   250  WHEELER    SALES    16629.00
   330  BURKE      SALES    12636.00

To update date and time values in a QBE update query, enclose them in single quotation marks. For example:



MY.INTERVIEW |     INTDATE    |   STARTTIME  | MANAGER  |
-------------+----------------+--------------+----------|
             | U.'1987-04-04' | U.'14.22.00' | 270      |

Rules for U.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]