日期:2014-05-16 浏览次数:20468 次
先来看两个例子:
1. 创建测试表,C1为主键。
CREATE TABLE [dbo].[ProdTable2](
[c1] [int] IDENTITY(1,1)NOTNULL,
[c2] [datetime] NULL,
[c3] [char](25)NULL,
CONSTRAINT[PK_ProdTable2] PRIMARY KEY CLUSTERED
(
[c1] ASC
)WITH(PAD_INDEX =OFF,STATISTICS_NORECOMPUTE =OFF,IGNORE_DUP_KEY=OFF,ALLOW_ROW_LOCKS =ON,ALLOW_PAGE_LOCKS =ON)ON [PRIMARY]
) ON [PRIMARY]
2. 创建非聚集索引:
CREATE NONCLUSTERED INDEX (
[c2] ASC
)
INCLUDE( [c3])WITH(PAD_INDEX =OFF,STATISTICS_NORECOMPUTE =OFF,SORT_IN_TEMPDB=OFF,IGNORE_DUP_KEY=OFF,DROP_EXISTING=OFF,ONLINE=OFF,ALLOW_ROW_LOCKS =ON,ALLOW_PAGE_LOCKS =ON)