Linker IT Software
Order Home
menubar-top-links menubar-top-rechts

SQL*XL: Database to Excel bridge

Related LIT software: litLIB: Excel power functions pack encOffice: Protect your Excel file easy and safe

Home Products SQL*XL Help Functions

Buy now

Download now

SQL*XL online help

SQL*XL: SQLCreateInsertStatement Excel function



=sqlxl.xla!SQLCreateInsertStatment(TableName, ColumnNames, Values [, DatabaseType] )

TableName (Datatype String): Name of the table
ColumnNames (Datatype Range): Address of the cells that contain the column names
Values (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

The SQLCreateInsertStatement function creates an SQL insert statement based on the supplied parameters. The syntax for an insert statement is: insert into TableName ( Columns ) values ( Values ). Example:
insert into emp (empno, ename, sal) values (123, 'Jones', 500);

SQL*XL can take your database type into account. E.g. for a MySQL database a date litteral 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'.

A1: =sqlxl.xla!SQLCreateInsertStatement( "emp", A1:D1, A2:D2 )

A1: =sqlxl.xla!SQLCreateInsertStatement( D12, A1:D1, A2:D2, "sql server")

A1: =sqlxl.xla!SQLCreateInsertStatement( "mytable", A1:D1, A2:D2, "odbc")

See also:

SQL*XL ribbon in Excel