1. 程式人生 > >索引的創建和使用

索引的創建和使用

HERE bsp reat 填充 非聚集索引 with 查看 exist 語法

使用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 xinxi

id

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

Create nonclustered index…………

查看索引的方式

使用系統的存儲過程查看錯音

EXEC sp_helpindex 表名

索引的創建和使用