Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with views

Browsing data in views Next Page

Viewing system table data


Data in the system tables is only viewable using views—specifically, system views; you cannot query a system table directly. With a few exceptions, almost all of the system tables have a corresponding view. The system views are named similar to the system tables, but without an I at the beginning. For example, the list of all views in the database is stored in the ISYSTAB system table. You can access this information using the SYSTAB system view. You can also use the more readable system view SYSVIEWS (recommended) to retrieve the same information.

For more information about these, see SYSTAB system view, and SYSVIEWS consolidated view.

For a list of views provided in SQL Anywhere, as well as a description of the type of information they contain, see 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 the DBA.

  2. Open the Views folder.

  3. Select the view corresponding to the desired system table.

  4. In the right pane, switch to the Data tab.

To view data for a system table via a system view (SQL)
  1. Connect to the database as the DBA.

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

  3. 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 SYS.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 ASCII
    ESCAPES OFF
    QUOTE '';