Contents Index The SYSCATALOG view Other system tables

ASA Getting Started
  System Tables

The SYSCOLUMNS view


Another important system table is a view called SYSCOLUMNS. This is a readable form of the system table SYSCOLUMN. It describes all the columns in all the tables in the database. To see the contents of a table, type the following command, in which tablename represents the name of the table whose columns you wish to list:

SELECT *
FROM sys.syscolumns
WHERE tname = tablename

For example,

SELECT *
FROM sys.syscolumns
WHERE tname = 'employee'
ORDER BY colno

This statement lists all the columns in the employee table. If you look at the columns to the right, you can see from the Coltype column that some columns in the employee table contain character information while others contain integer and date information.

You can also view columns in the Interactive SQL Lookup Table Name dialog, or in Sybase Central.

To view the columns in a table or view ( Interactive SQL )

  1. Invoke the list of tables by pressing F7.

  2. Select the table whose columns you wish to view.

  3. Click Show Columns.

To view the columns in a table or view ( Sybase Central )

  1. In the left pane of Sybase Central, select a database and open its Tables folder.

  2. In the left pane, select a table.

  3. In the right pane, click the Columns tab.

    You can now view and modify the columns.


Contents Index The SYSCATALOG view Other system tables