User`s guide
fastinsert
7-125
fastinsert
Add MATLAB data to database table
To export MATLAB data into a database, use these functions: fastinsert,
datainsert, and insert. For maximum performance, use datainsert. To use
datainsert, ensure that your input data is a cell array or numeric matrix with a
specific format. When your input data is a structure, dataset array, or table, or you
are using a native ODBC database connection, use fastinsert. If datainsert or
fastinsert do not work for you and you want to insert a small set of data, use insert.
For other differences among these functions, see “Inserting Data Using the Command
Line”.
Syntax
fastinsert(conn,tablename,colnames,data)
Description
fastinsert(conn,tablename,colnames,data) exports records from the MATLAB
variable data into new rows in an existing database table tablename and in existing
columns colnames using the connection conn. You do not specify the type of data you
are exporting; the data is exported in its current MATLAB format.
Examples
Insert a Table Record Using Native ODBC
Create a connection conn using the native ODBC interface and the dbtoolboxdemo
data source. This data source identifies a Microsoft Access database. This database
contains the table productTable with these columns:
• productNumber
• stockNumber