Insert multiple rows

Use an insert cursor to efficiently insert rows into a table in bulk.

To create an insert cursor, set the SQL_ENABLE_INSERT_CURSOR attribute by using SQLSetStmtOption, then call SQLParamOptions with the number of rows as a parameter. You can create an insert cursor for data types VARCHAR, LVARCHAR, and opaque.

When you open an insert cursor, a buffer is created in memory to hold a block of rows. The buffer receives rows of data as the program produces them; then they are passed to the database server in a block when the buffer is full. The buffer reduces the amount of communication between the program and the database server. As a result, the insertions go faster.