索引的创建和使用

使用T-sql语句创建索引

语法

if exists select * from sysindexes where name=‘索引名’)

go

drop index 表名.索引名

create [unique][clusterednonclustered] index 索引名 on 表名 (列名)[with fillfactor=x]

unique:唯一索引

clusterednonclustered:聚集索引或非聚集索引

fillfactor:充因子(系数):指定一个0-100之间的值,表示索引页填充的百分比

例如:

Create unique clustered index CL_xinxi on xinxiid

创建 唯一 聚集索引 cl_xinxi xinxi表上id

Create nonclustered index…………

查看索引的方式

使用系统的存储过程查看错音

EXEC sp_helpindex 表名

posted @ 2018-03-30 14:27  WhiteSpace  阅读(1087)  评论(0编辑  收藏  举报