HomeStartingEnvironmentDBMSVisualPQLProceduresSQLFormsHost/APIIndex
SQL homecontents start chapter top of pagebottom of pagenext page index System Tables

System Tables

System tables contain information about the database(s) and tabfile(s) currently connected. SELECT can be used to retrieve information from these in the same manner as from any other table or view though the menus can be used to access much of the same information in a more convenient manner.

As an example of using these tables, the following three SELECTs use the $REC system view which describes records. The first query retrieves all the information about each record in the default database; the second retrieves all the information about each record in the COMPANY database; the third retrieves all the information about the OCCUP record in the COMPANY database.

SELECT * FROM $REC
SELECT * FROM COMPANY.$REC
SELECT * FROM COMPANY.$REC WHERE RECNAME EQ 'OCCUP'
Most of the system tables are views. That is, they are not physical tables but are representations of the data presented by SQL as tables.

Database System Tables

Database system tables are all views and access information for a single database at a time. These views can be referenced on the FROM clause of the SELECT statement as: [database.]viewname

$DBCASE

$DBDOC
$DBSTATS
$REC
$SORTID
$VALLABEL
$VALVALUE
$VAR
$VARLABEL

Tabfile Views and Tables

$PASSWORD, $SECURITY and $VALUE_LABEL are tables; all the others are views. The tabfile views and tables can be referenced on the FROM clause of the SELECT as: [tabfile.] viewname

$COL

$INDEX
$INDEXCOL
$PASSWORD
$SECURITY
$TAB
$TFSTATS
$TRANGE
$VALUE_LABEL

Generic Tables

These tables do not reference a record or table and can be used at anytime. They are mainly for ODBC conformance.

$SQLTYPE

homecontents start chapter top of pagebottom of pagenext page index

$COL - Table Columns Schema

Contains one row for each column (or variable) in each table of the tabfile. The columns are:

TABFILE

TABLE
VARNAME
VARTYPE
VARLEN
VARLABEL
SCALE
BIAS
NRANGES
MAP
DECIMAL
FILL
LZERO
LNEG
LPOS
MISSING
NULL
FORMAT
SEPARATOR
THOUSANDS
TNEG
TPOS
VALLABS
ZERO

homecontents start chapter top of pagebottom of pagenext page index

$DBCASE - Database Case Schema

Contains only one row with general database parameters. The columns are:

DBNAME

UPLEVEL
CASEID
CASEIDOR
CASEIDTY
NCASES
NRECS
NTEMPS
NVARS
MAXCASES
MAXRECS
MAXRECTY

homecontents start chapter top of pagebottom of pagenext page index

$DBDOC - Database Documentation

Contains one row for each line of documentary text describing the database. The columns are:

RECNUM

RECNAME
LINENUM
LINE

homecontents start chapter top of pagebottom of pagenext page index

$DBSTATS - Database Statistics

Contains only one row with database statistics. The columns are:

DBNAME

UPLEVEL
CREDATE
CRETIME
CHNGDATE
CHNGTIME
NCASES
NRECS
NVARS
NTEMPS
AVGRECS
CASEIDSZ
CIRLEN
KEYSIZE
ACTDATB
INADATB
DATBLKSZ
MINDATSZ
MAXDATSZ
ACTINDB
INAINDB
INDBLKSZ
INDEXLEN
MAXINENT
MAXRECVR

homecontents start chapter top of pagebottom of pagenext page index

$INDEX - Tabfile Index Definitions

Contains one row for each index in the specified tabfile. The columns are:

TABFILE

TABLE
INDEX

homecontents start chapter top of pagebottom of pagenext page index

$INDEXCOL - Tabfile Index Column Definitions

Contains one row for each column in each index on tables in the specified tabfile. The columns are:

TABFILE

TABLE
INDEX
COL

homecontents start chapter top of pagebottom of pagenext page index

$PASSWORD - Group User Names

Contains one row for each group and group-user name. Only a DBA has the authority to view this table. The columns are:

GRPNAME

USERNAME

homecontents start chapter top of pagebottom of pagenext page index

$REC - Database Record Schema

Contains one row for each defined type of record in the database. The columns are:

RECNUM

RECNAME
COUNT
IDCNT
LENGTH
LOCK
MAX
VARCNT

homecontents start chapter top of pagebottom of pagenext page index

$SECURITY - Tabfile and Table Permissions

Contains a row for the tabfile, and a row per table and user permission. Only a DBA has the authority to view this table. Each column which refers to a permission holds one of three values, N, Y or G. These mean respectively, no permission, permission and permission with the ability to grant this permission to others. The columns are:

GRPNAME

USERNAME
TABLE
COLADD
TABFILECONNECT
TABCREATE
DBA
COLDELETE
ROWDELETE
TABLEDROP
INDEXCREATE
ROWADD
COLMOD
SELECT
ROWMOD
GRANTERGRPNAME
GRANTERUSERNAME
COLPERM

homecontents start chapter top of pagebottom of pagenext page index

$SORTID - Sort Id Variables

Contains one row for each keyfield (sort id) of every defined record in the database. The columns are:

RECNUMB

RECNAME
VARNAME
ORDER
TYPE

homecontents start chapter top of pagebottom of pagenext page index

$TAB - Tables

Contains one row for each table on the tabfile. The columns are:

TABFILE

TABLE
UPLEVEL
DATECREATE
TIMECREATE
DATEUPDATE
TIMEUPDATE
NROWS
NCOL
NINDEX
MAXROWS
LENGTH
NBLOCKS
NROWDELETE
PADDING

homecontents start chapter top of pagebottom of pagenext page index

$TFSTATS - Tabfile Statistics

Contains one row for each tabfile currently connected. The columns are:

TABFILE

DATECREATE
TIMECREATE
DATEUPDATE
TIMEUPDATE
NTABLES
TABFILELDI
BLOCKSZ
JOURNAL

homecontents start chapter top of pagebottom of pagenext page index

$TRANGE - Tabfile Column Ranges

Contains one row for each missing or valid range for any column in every table of the specified tabfile. The columns are:

TABFILE

TABLE
VARNAME
RANGETYPE
LOW
HIGH

homecontents start chapter top of pagebottom of pagenext page index

$VALLABEL - Database Value Labels

Contains one row for each value label of each variable of every defined record for the database. The columns are:

RECNUM

RECNAME
VARNAME
NVAL
SVAL
LABEL

homecontents start chapter top of pagebottom of pagenext page index

$VALUE_LABEL - Tabfile Value Labels

Contains one row for each value label in tables of the specified tabfile. The columns are:

TABLE

VARNAME
NVALUE
SVALUE
LABEL
MVALUE
REFCOUNT

homecontents start chapter top of pagebottom of pagenext page index

$VALVALUE - Database Valid Values

Contains one row for each valid value of each variable of every defined record for the current database. The columns are:

RECNUM

RECNAME
VARNAME
NVAL
SVAL

homecontents start chapter top of pagebottom of pagenext page index

$VAR - Database Variables

Contains one row for each variable of every record type of the current database. The columns are:

RECNUM

RECNAME
VARNAME
LABEL
TYPE
LENGTH
NMIN
NMAX
SMIN
SMAX
MISS
NMISS1
NMISS2
NMISS3
SMISS1
SMISS2
SMISS3
MAP
SCALE
VALLABS
VVALS

homecontents start chapter top of pagebottom of pagenext page index

$VARLABEL - Database Variable Labels

Contains one row for each line of label information for each variable of every defined record for the database. The columns are:

RECNUM

RECNAME
VARNAME
LINENO
LABEL

homecontents start chapter top of pagebottom of pagenext page index

$SQLTYPE - Generic Data Type Information

Contains one row for each type of variable used in SirSQL. This information is static within SirSQL. The columns are:

TYPE_NAME
DATA_TYPE
PRECISION
LITERAL_PREFIX
LITERAL_SUFFIX
CREATE_PARAMS
NULLABLE
CASE_SENSITIVE
SEARCHABLE
UNSIGNED_ATTRIBUTE
MONEY
AUTO_INCREMENT
LOCAL_TYPE_NAME
MINIMUM_SCALE
MAXIMUM_SCALE

  TYPE_NAME   DATA_TYPE  PRECISION  LITERAL_PREFIX  LITERAL_SUFFIX  CREATE_PARAMS    NULLABLE  CASE_SENSITIVE  SEARCHABLE  UNSIGNED_ATTRIBUTE  MONEY     AUTO_INCREMENT
  ----------  ---------  ---------  --------------  --------------  ---------------  --------  --------------  ----------  ------------------  --------  --------------
  TINYINT            -6          3  '               '               
  CHARACTER           1        254  '               '               length                  1               1           4                   0         0               0
  NUMERIC             2         15  '               '               length         
  NUMERIC             3         15  '               '               length,decimal          1               0           3                   0         0               0
  INT                 4         10  '               '               length,decimal          1               0           3                   0         0               0
  SMALLINT            5         15  '               '               length,decimal 
  FLOAT               6         15  '               '               length,decimal 
  REAL                7          7  '               '               length,decimal 
  DOUBLE              8         15  '               '               length,decimal 
  DATE                9         10  '               '               length                  1               0           3                   1         0               0
  TIME               10          8  '               '               'date_map'              1               0           3                   1         0               0
  CHARACTER          12        254  '               '               length                  1               1           4                   1         0               0
This table exists primarily for ODBC clients that may request this information.

homecontents start chapter top of pagebottom of pagenext page index