Viewing lists of system objects (SQL)

Use Sybase Central to display information about system objects such as system tables, system views, stored procedures, and domains. You perform this task when you want see the list of system objects in the database, and their definitions, or when you want to use their definition to create other similar objects.

Prerequisites

Privileges to view system objects.

Context and remarks

Many.

 Browse system objects using SQL
  1. In Interactive SQL, connect to a database.

  2. Execute a SELECT statement, querying the SYSOBJECT system view for a list of objects.

Results

The list of system objects displays in Interactive SQL.

Next

None.

Example

The following SELECT statement queries the SYSOBJECT system view, and returns the list of all tables and views owned by SYS and dbo. A join is made to the SYSTAB system view to return the object name, and SYSUSER system view to return the owner name.



SELECT b.table_name "Object Name", 
      c.user_name "Owner", 
      b.object_id "ID", 
      a.object_type "Type", 
      a.status "Status"
  FROM ( SYSOBJECT a JOIN SYSTAB b 
         ON a.object_id = b.object_id ) 
  JOIN SYSUSER c
WHERE c.user_name = 'SYS' 
   OR c.user_name = 'dbo'
ORDER BY c.user_name, b.table_name;

 See also