//查询表有哪些索引
SELECT
索引名称=a.name
,表名=c.name
,索引字段名=d.name
,索引字段位置=d.colid
FROM sys.sysindexes a
JOIN sys.sysindexkeys b ON a.id=b.id AND a.indid=b.indid
JOIN sys.sysobjects c ON b.id=c.id
JOIN sys.syscolumns d ON b.id=d.id AND b.colid=d.colid
WHERE
c.name=table --查指定表
ORDER BY c.name,a.name,d.name
//创建索引
CREATE NONCLUSTERED INDEX [索引名] ON 表名
(
RefRecordID ASC //需要创建索引的列
)