User`s guide

7 Functions — Alphabetical List
7-130
[13] [ 1700] [14.5000] '2009-05-24 10:58...'
Assign multiple rows of data to the cell array data. Each row contains data
for productNumber, Quantity, and Price. The first row data for insertion is
productNumber equals 7778, Quantity equals 125, and Price equals 23.00.
data = {7778,125,23.00,datestr(now,'yyyy-mm-dd HH:MM:SS');...
7779,1160,14.7,datestr(now,'yyyy-mm-dd HH:MM:SS');...
7780,150,54.5,datestr(now,'yyyy-mm-dd HH:MM:SS')};
Create a cell array containing these column names:
productNumber
Quantity
Price
inventoryDate
tablename = 'inventoryTable';
colnames = {'productNumber','Quantity','Price','inventoryDate'};
Insert the data into the inventoryTable.
fastinsert(conn,tablename,colnames,data)
For details about inserting data in bulk, see these sample files for different database
vendors that demonstrate bulk insert:
matlabroot/toolbox/database/dbdemos/mssqlserverbulkinsert.m
matlabroot/toolbox/database/dbdemos/mysqlbulkinsert.m
matlabroot/toolbox/database/dbdemos/oraclebulkinsert.m
Display the data in the inventoryTable table after insertion.
curs = exec(conn,'select * from inventoryTable');
curs = fetch(curs);
curs.Data
ans =
...
[ 13] [ 1700] [14.5000] '2009-05-24 10:58...'
[7778] [ 125] [ 23] '2014-10-23 10:21...'