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'"

 

Owners

This is a query to get all Sybase owners.

select name from dbo.sysusers where uid < 16384 order by name

 

Procedures

Query to get all Sybase procedures.

exec sp_stored_procedures

Filter query to return procedures for specific owners:

exec sp_stored_procedures '%', 'dbo'

 

Triggers

Query to get all Sybase triggers.

select * from sysobjects where type = 'TR'

Indexes

This is a query to get Sybase indexes for a particular table. In this example, the table used is myindex.

exec sp_helpindex 'myindex'

 




No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment





MarkiMarta.com. Notes of web-specialist
Since 2009
18+