SQLCreateDeleteStatement |
home |
Syntax:
=sqlxl.xla!SQLCreateDeleteStatment(TableName, PKColumns,
PKValues [, DatabaseType] )
TableName (Datatype String): Name of the table
PKColumns (Datatype Range):
Address of the cells that contain the column names
PKValues (Datatype Range):
Address of the cells that contain the data
DatabaseType (Datatype String):
Optional ; Database type so the SQL insert statement can use specific database
syntax. Possible values: Oracle, SQL Server, MySQL, ODBC, Access
Description:
The SQLCreateDeleteStatement function creates a SQL delete statement based on the
supplied parameters. The syntax for an insert statement is: delete from
TableName where pk1=value1 and
pk2=value2.
Example:
delete from emp where empno =
123;
SQL*XL can take your database type into account. E.g. for a MySQL database a date literal will be typed as e.g. '2006-01-23 11:23:01' whereas an Oracle date will be typed as: to_date('23-01-2006 11:23:01','dd-mm-yyyy hh24:nn:ss')
Please ensure that the values in the Excel cell are properly formatted. A number formatted in Excel as a Text will be taken as a string value. E.g. the number 1 formatted as text will be created in the statement as '1'.
Examples:
A1: =sqlxl.xla!SQLCreateDeleteStatement( "emp", A1,
A2 )
A1: =sqlxl.xla!SQLCreateDeleteStatement( D12, A1:B1, A2:B2, "sql server")
A1: =sqlxl.xla!SQLCreateDeleteStatement( "mytable", A1:D1, A2:D2, "odbc")
See also: