SYSINDEXES ビューの各ローは、データベース内のインデックス 1 つを示します。このビューの代わりに、SYSIDX と SYSIDXCOL のシステム・ビューを使用することもできます。
ビューを構成するテーブルとカラムは、以下の SQL 文で示されます。特定のテーブルまたはカラムの詳細については、以下のビュー定義にあるリンクを参照してください。
ALTER VIEW "SYS"."SYSINDEXES"( icreator, iname,fname,creator,tname,indextype, colnames,interval,level_num ) as select u.user_name,idx.index_name,dbs.dbspace_name,u.user_name, tab.table_name, case idx.index_category when 1 then 'Primary Key' when 2 then 'Foreign Key' when 3 then( if idx."unique" = 4 then 'Non-unique' else if idx."unique" = 2 then 'UNIQUE constraint' else 'Unique' endif endif) when 4 then 'Text Index' end, (select list(string(c.column_name, if ixc."order" = 'A' then ' ASC' else ' DESC' endif) order by ixc.table_id asc,ixc.index_id asc,ixc.sequence asc) from SYS.ISYSIDXCOL as ixc join SYS.ISYSTABCOL as c on( c.table_id = ixc.table_id and c.column_id = ixc.column_id) where ixc.index_id = idx.index_id and ixc.table_id = idx.table_id), 0,0 from SYS.ISYSTAB as tab join SYS.ISYSDBSPACE as dbs on(tab.dbspace_id = dbs.dbspace_id) join SYS.ISYSIDX as idx on(idx.table_id = tab.table_id) join SYS.ISYSUSER as u on u.user_id = tab.creator; |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |