MATLAB DATABASE TOOLBOX RELEASE NOTES Uživatelská příručka Strana 452

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 684
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 451
7 Functions — Alphabetical List
7-22
conn = database('dbname','username','pwd',...
'Vendor','Microsoft SQL Server',...
'Server','sname',...
'portnumber',123456);
Retrieve the column names for each table in a schema. Here, this code assumes that the
database contains the catalog name toy_store and the schema name schema.
columnlist = columns(conn,'toy_store','schema')
columnlist =
'inserttest' {1x3 cell}
'inventoryTable' {1x4 cell}
'largedata' {1x9 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 inventoryTable table.
columnlist{2,2}
ans =
'productNumber' 'Quantity' 'Price' 'inventoryDate'
Close the database connection.
close(conn)
Retrieve the Column List for a Catalog, Schema, and Table Name 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);
Zobrazit stránku 451
1 2 ... 447 448 449 450 451 452 453 454 455 456 457 ... 683 684

Komentáře k této Příručce

Žádné komentáře