Database Toolbox |
Get attributes of columns in fetched data set
Syntax
Description
attributes = attr(curs, colnum)
retrieves attribute information for the specified column number colnum
, in the fetched data set curs
.
attributes = attr(curs)
retrieves attribute information for all columns in the fetched data set curs
, and stores it in a cell array. Use attributes(colnum)
to display the attributes for column colnum
.
The returned attributes are listed in the following table.
Attribute |
Description |
fieldName |
Name of the column |
typeName |
Data type |
typeValue |
Numerical representation of the data type |
columnWidth |
Size of the field |
precision |
Precision value for floating and double data types; an empty value is returned for strings |
scale |
Precision value for real and numeric data types; an empty value is returned for strings |
currency |
If true , data format is currency |
readOnly |
If true , the data cannot be overwritten |
nullable |
If true , the data can be NULL |
Message |
Error message returned by fetch |
Example 1--Get Attributes for One Column
Get the column attributes for the fourth column of a fetched data set.
attr(curs, 4) ans = fieldName: 'Age' typeName: 'LONG' typeValue: 4 columnWidth: 11 precision: [] scale: [] currency: 'false' readOnly: 'false' nullable: 'true' Message: []
Example 2--Get Attributes for All Columns
Get the column attributes for curs
, and assign them to attributes
.
View the attributes of column 4.
MATLAB returns the attributes of column 4.
ans = fieldName: 'Age' typeName: 'LONG' typeValue: 4 columnWidth: 11 precision: [] scale: [] currency: 'false' readOnly: 'false' nullable: 'true' Message: []
See Also
cols
, columnnames
, columns
, dmd
, fetch
, get
, tables
, width
Functions -- Alphabetical List | bestrowid |
© 1994-2005 The MathWorks, Inc.