SQLDelete() function
- Last UpdatedJun 17, 2024
- 1 minute read
The SQLDelete() function removes all records from a table that match a condition specified by the WhereExpr argument.
Category
SQL
Syntax
[ResultCode=]SQLDelete(ConnectionID, TableName, WhereExpr);
Arguments
ConnectionID
Name of a memory integer tag that holds the number (ID) assigned by the SQLConnect() function to each database connection.
TableName
Name of the table in which records are cleared that meet the condition specified by the WhereExpr argument.
WhereExpr
Defines a condition that can be either true or false for any row of the table. The SQLDelete() function deletes only those row records in which the WhereExpr condition is true. The expression must be in the following format:
ColumnName comparison_operator expression
Note: The SQLDelete() function cannot contain a null WhereExpr argument.
Example
The following statement deletes all records in the BATCH1 table whose lot number is equal to 65:
ResultCode=SQLDelete(ConnectionID,"BATCH1", "lotno=65");
Note: If the column is a character data type, the expression must be in single quotes such as "MachineID='AG_LX7_2'".
See Also
SQLConnect()