Update DataTableRows
Use this command to update rows in a DataTable object. You can update all rows or only those rows that meet certain criteria.
Syntax
Update DatatableRows in DataTableName SET "[ColumnName1]='Value1'[,...[ColumnNameN]='ValueN']" [WHERE "[ConditionalColumn1]Operator ConditionValue1 [AND|OR [ConditionalColumn2] Operator ConditionValue2]"]
where:
- DataTableName is the name of the DataTable object that you want to update.
- ColumnName1 is the name of the column to update. If a column name contains spaces, you must enclose it in square brackets. For example, [Phone Number].
- Value1 is the new value for the column. You must enclose string values in single quotes. For example, 'contract'.
Note: Separate multiple [ColumnName]='Value' statements with a comma.
- WHERE updates the values only for the rows that meet the specified condition.
- ConditionalColumn1 is the column that must contain a specific value in order for the row to be updated. If a column name contains spaces, you must enclose it in square brackets. For example [Employee Type]. You cannot specify a userlist column as a ConditionalColumn.
- Operator is the relational operator and can be one of the following:
Value Description EQ or ==
Equal to.
GE or >=
Greater than or equal to.
GT or >
Greater than.
LE or <=
Less than or equal to.
LT or <
Less than.
NE or !=
Not equal to.
- ConditionValue1 is the value that ConditionalColumn1 must contain in order for the row to be updated. Values can be numbers or strings, or, in the case of boolean columns, 1 for TRUE and 0 for FALSE. You must enclose string values in single quotes. For example, 'contract'.
Note: You can specify two conditions in one And or Or clause.
Syntax example
Update DatatableRows in DataTableName SET "[ColumnName1]='Value1'[,...[ColumnNameN]='ValueN']" [WHERE "[ConditionalColumn1]Operator ConditionValue1 [AND|OR [ConditionalColumn2] Operator ConditionValue2]"]
Syntax example
Update DatatableRows in Employees SET "[PhoneNumber]='905-940-1510'" WHERE "[Office Location]= 'Markham'"
Syntax example
Update DatatableRows in Salaries SET "[Salary]=35" WHERE "[Contract Employee]= '1'"
See also