MATLAB DATABASE TOOLBOX RELEASE NOTES Guide de l'utilisateur Page 560

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 684
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 559
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...'
Vue de la page 559
1 2 ... 555 556 557 558 559 560 561 562 563 564 565 ... 683 684

Commentaires sur ces manuels

Pas de commentaire