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