Queries for a Sybase Administrator
While integration with Sybase server, I had to study some queries. When me and Sybase administrator couldn't understand the reason of error, we have started to look for missed procedures or tables. So, when I had to use some queries to look for tables, view, stored procedures etc.
Tables and Views
Get list of all tables, views and system tables
exec sp_tables '%'
Get list of only tables
exec sp_tables '%', '%', '%', "'TABLE'"
Get list of only views
exec sp_tables '%', '%', '%', "'VIEW'"
Get list of system tables only
exec sp_tables '%', '%', '%', "'SYSTEM TABLE'"
This is a query to get all Sybase owners.
select name from dbo.sysusers where uid < 16384 order by name
Query to get all Sybase procedures.
Filter query to return procedures for specific owners:
exec sp_stored_procedures '%', 'dbo'
Query to get all Sybase triggers.
select * from sysobjects where type = 'TR'
This is a query to get Sybase indexes for a particular table. In this example, the table used is myindex.
exec sp_helpindex 'myindex'