BuildDelete

(ODBC Manager Library)

Description:              Builds SQL Delete statements based on arrays of field names and values.  Made to be called as a subroutine only.

Returns:                    Text

Usage:                       Script   

 Format:                    \ODBCManager\BuildDelete(  TableName,  WhereFields,  WhereOperators,  WhereValues,  WhereSQLDataTypes,  WhereAND,  dbType)

Parameters:             TableName      { text }  { required }  { no default: }

                                                Table name to delete records from

                             WhereFields    { text or array }  { required }  { no default: }

                                                May be a simple value or a one-dimensional array.  Field names for the WHERE selection clause

                             WhereOperators     { text or array }  { required }  { no default: }

                                                May be a simple value or a one-dimensional array. Operators for the WHERE selection clause

                             WhereValues            { text or array }  { required }  { no default: }

                                                Any SQL data type.  May be a simple value or a one-dimensional array.  Values for the WHERE selection clause

                             WhereSQLDataTypes          { text or array }  { required }  { no default: }

                                                Values indicating the data type of the insert values. Should be a simple value or an array matching the WhereFields parameter.  Refer to Data Type Codes used in the ODBC Manager for a list of the codes.

                             WhereAND      { Boolean }  { required }  { no default: }

                                                Any expression that evaluates to a Boolean true or false.  If set to true (non-zero) then the components of the WHERE clauses are to be ANDed together.  If false (0) an OR is used between the sub clauses.

                             dbType                        { numeric }  { required }  { no default: }

                                                Database type, used for conversions of time or date formats. Refer to Database Type Codes used in the ODBC Manager for a list of the possible values.

Returns:                Returns the SQL statement as a text string

Comments:               This module is a member of the ODBCManager Library, and must therefore be prefaced by \ODBCManager\, as shown in "Format" above.

                             If the WhereFields parameter is invalid, the SQL statement returned will be "DELETE FROM [Tablename]".  The ExecuteQuery function includes a check that will prevent a delete statement without a where clause from running.

See Also:

BuildInsert  |  BuildSelect  |  BuildUpdate