DeleteSQL
Mon 01 January 2018Syntax
DeleteSQL([SQL.]sqlname[, dbtype[, effdt]])
Description
Use the DeleteSQL function to programmatically delete a SQL definition. The SQL definition must have already been created and saved, either using the CreateSQL and StoreSQL functions, or by using Application Designer.
When you create a SQL definition, you must create a base statement before you can create other types of statements, that is, one that has a dbtype as GENERIC and effdt as the null date (or Date(19000101)). If you specify a base (generic) statement to be deleted, all statements as well as the generic statement are deleted.
If you specify a non-generic statement that ends up matching the generic statement, DeleteSQL does not delete anything, and returns False.
You must commit all database changes prior to using this function. This is to avoid locking critical Tools tables and hence freezing all other users. You receive a runtime error message if you try to use this function when there are pending database updates, and your PeopleCode program terminates. You need to commit any database updates prior to using this function. The CommitWork PeopleCode function has been enhanced to allow this.
Parameters
Field or Control |
Definition |
---|---|
sqlname |
Specify the name of a SQL definition. This is either in the form SQL . sqlname or a string value giving the sqlname. |
dbtype |
Specify the database type associated with the SQL definition. This parameter takes a string value. If dbtype isnât specified or is null (""), it set by default to the current database type (the value returned from the %DbName system variable.) Valid values for dbtype are as follows. These values are not case sensitive:
Note: Database platforms are subject to change. |
effdt |
Specify the effective date associated with the SQL definition. If effdt isnât specified, it is set by default to the current as of date, that is, the value returned from the %AsOfDate system variable. |
Returns
A Boolean value: True if the delete was successful, False if the specified SQL statement wasnât found, and terminates with an error message if there was another problem (that is, date in incorrect format, and so on.)