User`s guide

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);