查询Sybase ASE 对象如 tables, views, indexes, procedures, triggers, schemas, and users.

查询Sybase objects such as tables, views, indexes, procedures, triggers, schemas, and users.

Tables and Views

To get all tables, views, and system tables, the following Sybase system stored procedure can be executed. 

exec sp_tables '%' 

To filter by database for tables only, for example master: 

exec sp_tables '%', '%', 'master', "'TABLE'" 

To filter by database and owner / schema for tables only, for example, master and dbo: 

exec sp_tables '%', 'dbo', 'master', "'TABLE'" 

To return only views, replace "'TABLE'" with "'VIEW'". To return only system tables, replace "'TABLE'" with "'SYSTEM TABLE'".

 

Owners

This is a query to get all Sybase owners. 

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

 

Procedures

This is a query to get all Sybase procedures. 

exec sp_stored_procedures '%' 

The query can be filtered to return procedures for specific owners and databases by appending more information onto the procedure call, such as the following: 

exec sp_stored_procedures '%', 'dbo', 'master'

 

Procedure Columns

This is a system stored procedure call to get the columns in a Sybase procedure. 

exec sp_sproc_columns 'get_employee_names', 'dbo', 'sample'

 

Triggers

This is a query to get all Sybase triggers. 

select * from sysobjects where type = 'TR' 

The query can be filtered to return triggers for a specific owner by appending a user_name call onto the where clause to the query. 

select * from sysobjects where type = 'TR' and user_name(sysobjects.uid) = 'dbo'

 

Indexes

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


exec sp_helpindex 'employee'



转自:http://razorsql.com/articles/sybase_admin_queries.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值