例如在字段row_index上建有索引Rowindex
请问怎么在代码中实现取得row_index上建有的索引名?

解决方案 »

  1.   


    select name from sysindexes where id=object_id('Doc')
    and keys is not null-----------------
    select ind.*--obj.name TableName,ind.name IndexName 
    from sysindexes ind
    inner join sysobjects obj
    on ind.id=obj.id 
    where ind.keys is not null
    --and (ind.id=object_id('Doc') or obj.name='t' or ind.id=1026102696)
    and indid=1 and obj.xtype='U'indid 索引 ID: 
    1 = 聚集索引
    >1 = 非聚集
    255 = 具有 text 或 image 数据的表条目
      

  2.   

    楼上大哥,小弟没有理解
    select ind.*--obj.name TableName,ind.name IndexName 
    from sysindexes ind
    inner join sysobjects obj
    on ind.id=obj.id 
    where ind.keys is not null
    --and (ind.id=object_id('Doc') or obj.name='t' or ind.id=1026102696)
    and indid=1 and obj.xtype='U'这段是什么意思〉?“--”号后面的SQL语句是注释么?在数据库中有很多表
    可能都在同一字段建了索引,是不是要分表取索引名