sqlStr="select 索引名称=a.name,表名=c.name,索引字段名=d.name ,"+
"排序 = CASE indexkey_property(OBJECT_ID('"+this.TableName+"'),a.indid,b.keyno,'IsDescending')"+
" WHEN 1 THEN '降序' WHEN 0 THEN '升序' END "+
" from sysindexes a"+
" join sysindexkeys b on a.id=b.id and a.indid=b.indid "+
" join sysobjects c on b.id=c.id"+
" join syscolumns d on b.id=d.id and b.colid=d.colid "+
" where a.indid not in(0,255)"+
" and c.xtype='U' and c.status>0 and c.name='"+this.TableName+"' AND a.name NOT LIKE '_wa_sys%' "+
" order by c.name,a.name,d.name";
其中indexkey_property是取索引的升序还是降序,“NOT LIKE '_wa_sys%' ”是不显示出系统的假索引,剩下的就是sql server的系统表了