Update-SQL
This is one of several SQL commands added in Visual FoxPro. This one behaves pretty much like the Xbase REPLACE command—it updates one or more fields in one or more records of a single table.
Usage |
UPDATE [ DatabaseName! ] TableName SET FieldName1 = uExpr1 [, FieldName2 = uExpr2 [, ... ] ] [ WHERE lCondition ] |
Parameter |
Value |
Meaning |
DatabaseName |
Name |
Name of the database containing TableName. |
TableName |
Name |
The table containing the fields to be updated. |
FieldNamex |
Name |
The xth field to be updated. |
uExprx |
Same type as FieldNamex |
An expression to evaluate to assign a value to FieldNamex. |
lCondition |
Logical |
An expression determining which records get updated. |
Example |
* This is the same example given for REPLACE. * Here's the equivalent using UPDATE. * Suppose the area code for a bunch of phone numbers * changes. You need to update those records. * Assume you've stored the exchanges that are changing * in a table, EXCHANGES, with one field, Exchange, and * a tag on that field. * The old area code is stored in cOldCode. * The new area code is stored in cNewCode USE PhoneList UPDATE Exchanges SET AreaCode = cNewCode ; WHERE AreaCode = cOldCode ; AND LEFT(Phone,3) IN (SELECT Exchange FROM Exchanges) |
See Also |