The SQL_Execute() function executes the SQL string using the pass-through SQL connection specified.
• SQL_connection – A long integer specifying the pass-through SQL connection through which the SQL string will be executed.
• SQL_string – A text field containing the SQL statements to be executed. The text field can be a window field, table field or text local variable.
A long integer indicating the status of the SQL execution. The value 0 is returned if the statements were executed successfully. Any other value indicates an error occurred.
Use the SQL_GetError() function to retrieve specific information about any error that occurred while executing SQL statements.
In certain cases, you may need to execute more than 32K of SQL statements at one time. You can do this using an array of text fields. Copy the first 32K of SQL statements into the first element of the text array, the next 32K of statements into the second element, and so on. Then pass the first element of the array to the SQL_Execute() function. The array elements will automatically be assembled and the SQL statements will be executed in the appropriate order. For example, the following statement executes the SQL statements in the SQL_Statements array field.
status = SQL_Execute(SQL_connection, field SQL_Statements);
If you use the same text field array to execute several sets of SQL statements, be sure to clear out any unused elements of the array before you execute additional statements. Otherwise, you may inadvertently run some SQL statements from the previous set.