Deletes selected rows from a database table. (This function is equivalent to a SQL DELETE statement.)

Function Group Execution Windows Embedded Thin Client Mobile Access
DBDelete Database/ERP Synchronous Supported Supported Supported Executed on Server
Note: This feature emulates SQL (Structured Query Language) database operations. You should be familiar with how SQL commands are formed and executed before you use this feature.


  DBDelete( strDBConn, strTable, strCondition, "optStrErrorTag" )  
The name of the database connection. Connections are configured in the Database/ERP folder.
The name of the table in the database.
A string that specifies which rows of the table to select. This is equivalent to the SQL WHERE clause, and the string should follow the same syntax.
Tip: To delete all rows in the table, make the condition statement a single space (” “).
The name of a String tag that will receive detailed error messages, if errors occur during runtime.
Note: The tag name should be enclosed in quotes, as shown in the syntax diagram, or else the function will try to use the value of the tag.

This is an optional parameter.

Returned value

Returns the number of rows deleted from the table. In case of error, returns a negative number.


As used in a Math worksheet:
Tag Name Expression
nRowsDeleted DBDelete( “DB1″, “Table1″, “Column1 > 1000″, “TagError” ) // Deletes all rows in Table1 where the value of Column1 is greater than 1000. The returned value (i.e., the number of rows deleted) is written to TagError.
Tag DBDelete( “DB1″, “Table1″, ” ” ) // Deletes all rows of Table1.