Sybase ASA中查询元信息的几个常用SQL函数:
sp_column_privileges Unsupported
sp_columns table-name [, table-owner ] [, table-qualifier] [, column-name] 返回指定列的数据类型
sp_databases Unsupported
sp_datatype_info Unsupported
sp_fkeys pktable_name [, pktable-owner][, pktable-qualifier] [, fktable-name] [, fktable_owner] [, fktable-qualifier] 表的外键信息
sp_pkeys table-name [, table_owner] [, table_qualifier] 表的主键信息
sp_server_info Unsupported
sp_special_columns table_name [, table-owner] [, table-qualifier] [, col-type] 表的标识行的特定列的信息
sp_sproc_columns proc-name [, proc_owner] [, proc-qualifier] [, column-name] 存储过程的输入输出参数信息
sp_stored_procedures [sp-name] [, sp-owner] [, sp-qualifier] 一个或者多个存储过程信息
sp_statistics [table_name] [, table_owner] [, table_qualities] [, index_name] [, is_unique] 表及其索引列的信息
sp_tables table-name [, table-owner] [, table-qualifier] [, table-type] 指定表的信息
例:
1.查询数据库jagdemo里有哪些表
sp_tables
current database,creator,tname,ifif SYSTABLE.table_type = 'B,null
'jagdemo','SYS','SYSARTICLE','SYSTEM TABLE',
'jagdemo','SYS','SYSARTICLECOL','SYSTEM TABLE',
'jagdemo','DBA','account','TABLE',
'jagdemo','SYS','SYSREMOTEUSER','SYSTEM TABLE',
'jagdemo','SYS','SYSSUBSCRIPTION','SYSTEM TABLE',
'jagdemo','SYS','SYSUSERMESSAGES','SYSTEM TABLE',
'jagdemo','SYS','SYSUSERTYPE','SYSTEM TABLE',
'jagdemo','SYS','SYSEXTENT','SYSTEM TABLE',
'jagdemo','SYS','SYSREMOTETYPE','SYSTEM TABLE',
'jagdemo','SYS','SYSSQLSERVERTYPE','SYSTEM TABLE',
'jagdemo','SYS','SYSTYPEMAP','SYSTEM TABLE',
'jagdemo','SYS','SYSUSERLIST','VIEW',
'jagdemo','SYS','SYSCOLAUTH','VIEW',
'jagdemo','SYS','SYSINDEXES','VIEW',
'jagdemo','SYS','SYSUSERAUTH','VIEW',
2.查询表account的列信息
sp_columns account
jagdemo DBA account balance 7 real 7 4 0 10 0 59 2
jagdemo DBA account student_id 1 char 16 16 0 0