在数据库中我现在遇到这么一个问题:我要找到一个表所有的索引信息,通过JDBC函数getindexinfo()我可以找到一个表所有索引的名字,所属表,索引类型(unique或者clustered),所在的列,升降序等基本信息,但在创建索引时的一些索引选项如:fillfactor,pad_index,dbcc indexdefrag,drop_existing,dbcc showcontig等我却不知道该怎么找到 ,在JDBC中好像没有这种方法,而在系统表中我也没发现有哪个系统表中有这种信息。
    各位大虾,帮帮忙吧??!!谢谢!

解决方案 »

  1.   

    你可以使用系统存储过程,来显示表中所有的索引信息这个存储过程,是用来查询某表的定义
    exec sp_help table_name ---将table_name换成你要查询的表名
      

  2.   

    也可以使用:exec sp_helpindex 'table_name'更直接地查看表上索引的情况。
      

  3.   

    在当前数据库sysindexes表中能看到填充因子一列 即OrigFillFactor (因为索引建立完毕之后不再动态维护填充因子 所以有Orig)
    比较pad_index勾选前后sysindexes表中差异情况 看不出什么名堂来:(id          status      first          indid  root           minlen keycnt groupid dpages      reserved    used        rowcnt               rowmodctr   reserved3 reserved4 xmaxlen maxirow OrigFillFactor StatVersion reserved2   FirstIAM       impid  lockflags pgmodctr    keys                                                                                                                                                                                                                                                               name                                                                                                                             statblob                                                                                                                                                                                                                                                         maxlen      rows        
    ----------- ----------- -------------- ------ -------------- ------ ------ ------- ----------- ----------- ----------- -------------------- ----------- --------- --------- ------- ------- -------------- ----------- ----------- -------------- ------ --------- ----------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- ----------- 
    405576483   2097152     0x800000000100 3      0x800000000100 13     2      1       1           2           2           9                    -19         0         0         30      36      60             0           0           0x810000000100 0      0         0           0x3800380004000A00000000000000000001000100000000000400010000000000AD01AD0008000000000000000000000000000500000000020000050000000100                                                                                                                                 uix_test                                                                                                                         0x040000005259BB00B297000009000000000000000900000000000000398EE33D0000003E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 8000        9
    405576483   2097408     0x5E0000000100 3      0x5E0000000100 13     2      1       1           2           2           9                    -19         0         0         30      36      60             0           0           0x5F0000000100 0      0         0           0x3800380004000A00000000000000000001000100000000000400010000000000AD01AD0008000000000000000000000000000500000000020000050000000100                                                                                                                                 uix_test                                                                                                                         0x0400000072B2BC00B297000009000000000000000900000000000000398EE33D0000003E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 8000        9(2 row(s) affected)