Viewing system table data using regular views

Data in the system tables is only viewable by querying the system views; you cannot query a system table directly. With a few exceptions, each system tables has a corresponding view.

The system views are named similar to the system tables, but without an I at the beginning. For example, to view the data in the ISYSTAB system table, you query the SYSTAB system view.

For a list of views provided in SQL Anywhere, as well as a description of the type of information they contain, see System views.

You can either use Sybase Central or Interactive SQL to browse system view data.

To view data for a system table via a system view (Sybase Central)

  1. Connect to the database as a user with DBA authority.

  2. In the left pane, double-click Views.

  3. Select the view corresponding to the system table.

  4. In the right pane, click the Data tab.

To view data for a system table via a system view (SQL)

  1. Connect to the database as a user with DBA authority.

  2. Execute a SELECT statement that references the system view corresponding to the system table.

Example

Suppose you want to view the data in the ISYSTAB system table. Since you cannot query the table directly, the following statement displays all data in the corresponding SYSTAB system view:

SELECT * FROM SYS.SYSTAB;

Sometimes, columns that exist in the system table do not exist in the corresponding system view. To extract a text file containing the definition of a specific view, use a statement such as the following:

SELECT viewtext
FROM SYS.SYSVIEWS
WHERE viewname = 'SYSTAB';
OUTPUT TO viewtext.sql
FORMAT TEXT
ESCAPES OFF
QUOTE '';