Generate SQL INSERT statement
sqlForInsert( tablename, fields, sqlSource, sourceAreValues = !grepl(sqlSource, "^SELECT"), ignore = FALSE )
tablename | table name |
---|---|
fields | field names, separated by comma |
sqlSource | value tupels of form (value1.1, value1.2, value1.3, ...) (value2.1, value2.2, value2.3, ...) ... or SQL SELECT statement providing these tupels |
sourceAreValues | if TRUE, sqlSource is expected to be an SQL query providing data to be inserted -> no keyword VALUES in generated SQL code |
ignore | if TRUE the keyword IGNORE is inserted between INSERT and INTO in the SQL statement -> no error will be given if data to insert already exists |