User`s guide
7 Functions — Alphabetical List
7-70
preview
Display first eight records of data in DatabaseDatastore
Syntax
data = preview(dbds)
Description
data = preview(dbds) displays the first eight records of data in the
DatabaseDatastore object dbds.
Examples
Preview Data in a DatabaseDatastore
The default output data type of any datastore is a table. Set the database preference
for the data return format 'DataReturnFormat' to table for consistency across data
types.
setdbprefs('DataReturnFormat','table')
Create a database connection conn using the native ODBC interface. This code assumes
you are connecting to a MySQL database with the data source named MySQL, user name
username, and password pwd. MySQL contains the table named productTable with 15
product records.
conn = database.ODBCConnection('MySQL','username','pwd');
Create a DatabaseDatastore object dbds using the database connection conn and
SQL query sqlquery. This SQL query retrieves all products from the product table
productTable ordered by product number.
sqlquery = 'select * from productTable order by productNumber';
dbds = datastore(conn,sqlquery);