Difference between revisions of "SYSCOLUMNS"

From Lianjapedia
Jump to: navigation, search
Line 41: Line 41:
 
|SQL_DATETIME_SUB||N||1||Reserved
 
|SQL_DATETIME_SUB||N||1||Reserved
 
|-
 
|-
|CHAR_OCTET_LENGTH||N||1||For char types the maximum number of bytes in the column
+
|valign="top"|CHAR_OCTET_LENGTH||valign="top"|N||valign="top"|1||For char types the maximum number of bytes in the column
 
|-
 
|-
|ORDINAL_POSITION||N||4||Index of column in table (starting at 1)
+
|valign="top"|ORDINAL_POSITION||valign="top"|N||valign="top"|4||Index of column in table (starting at 1)
 
|-
 
|-
|IS_NULLABLE||C||3||"NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means unknown.
+
|valign="top"|IS_NULLABLE||valign="top"|C||valign="top"|3||"NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means unknown.
 
|-
 
|-
 
|}
 
|}

Revision as of 14:10, 18 January 2013

Purpose

Description of the table columns available in the catalog

See Also

DATA TYPES, SELECT, SYSTEM TABLES

Description

System Tables are system defined read-only tables. You can query these tables using the SELECT statement.

Column Data Type Width Description
TABLE_CAT C 30 Table catalog
TABLE_SCHEM C 30 Table schema
TABLE_NAME C 30 Table name
COLUMN_NAME C 25 Column name
DATA_TYPE N 2 SQL data type
TYPE_NAME C 30 Data source dependent type name
COLUMN_SIZE N 3 Precision
BUFFER_LENGTH L 1 Reserved
DECIMAL_DIGITS N 2 Scale
NUM_PREC_RADIX N 2 Radix (typically either 10 or 2)
NULLABLE N 2 Is NULL allowed?
REMARKS C 25 Comment describing column
COLUMN_DEF C 30 Default value
SQL_DATA_TYPE N 1 Reserved
SQL_DATETIME_SUB N 1 Reserved
CHAR_OCTET_LENGTH N 1 For char types the maximum number of bytes in the column
ORDINAL_POSITION N 4 Index of column in table (starting at 1)
IS_NULLABLE C 3 "NO" means column definitely does not allow NULL values; "YES" means the column might allow NULL values. An empty string means unknown.

Example

SELECT * FROM syscolumns;
WHERE type_name = 'DATETIME'