MATLAB DATABASE TOOLBOX RELEASE NOTES Betriebsanweisung Seite 451

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 684
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 450
columns
7-21
Examples
Retrieve the Column List for a Catalog Using the Database Connection
Create a database connection conn. This code uses database name dbname, user name
username, password pwd, database server name sname, and port number 123456 to
connect to a Microsoft SQL Server database.
conn = database('dbname','username','pwd',...
'Vendor','Microsoft SQL Server',...
'Server','sname',...
'portnumber',123456);
Retrieve the column names for each table in a catalog. Here, this code assumes that the
database contains the catalog name toy_store.
columnlist = columns(conn,'toy_store')
columnlist =
'salesVolume' {1x13 cell}
'suppliers' {1x5 cell}
'yearlySales' {1x3 cell}
...
columns returns a cell array. The first column contains the table names as strings. The
second column contains the corresponding column name lists as cell arrays.
Display the column names for the suppliers table.
columnlist{2,2}
ans =
'SupplierNumber' 'SupplierName' 'City' 'Country' 'FaxNumber'
Close the database connection.
close(conn)
Retrieve the Column List for a Catalog and Schema Using the Database Connection
Create a database connection conn. This code uses database name dbname, user name
username, password pwd, database server name sname, and port number 123456 to
connect to a Microsoft SQL Server database.
Seitenansicht 450
1 2 ... 446 447 448 449 450 451 452 453 454 455 456 ... 683 684

Kommentare zu diesen Handbüchern

Keine Kommentare