日期:2014-05-17 浏览次数:20490 次
CREATE TABLE [dbo].[test2](
[FID] [int] IDENTITY(1,1) NOT NULL,
[FDate] [datetime] NULL,
[FCol1] [int] NULL,
[FBillNo] [varchar](20) NULL,
CONSTRAINT [PK_test2] PRIMARY KEY CLUSTERED ([FID] ASC)
)
GO
CREATE NONCLUSTERED INDEX [IX_test2] ON [dbo].[test2]([FDate] ASC,[FID] ASC)
SELECT * FROM test2 WHERE FDate >= '2013-08-01' AND FDate <= '2013-08-31'并不走索引IX_test2,而是走聚合索引PK_test2
CREATE NONCLUSTERED INDEX [IX_test4] ON [dbo].[test4]([FDate] ASC,[FID] ASC)
INCLUDE ([FCol1],[FBillNo])