USE IndexDB
GO
SELECT * INTO SalesOrderheader FROM AdventureWorks2008r2.Sales.SalesOrderheader
GO
--Unique Clustered index
CREATE UNIQUE CLUSTERED INDEX ix_SalesOrderheader ON SalesOrderheader(SalesOrderid)
GO
--Filtered Index
CREATE INDEX ix_filtered_index ON SalesOrderheader(orderdate) WHERE orderdate>'2008-01-01'
SELECT orderdate,SalesOrderid FROM SalesOrderheader WHERE
orderdate>'2008-05-01'
GO
SELECT orderdate,SalesOrderid FROM SalesOrderheader WHERE
orderdate='2008-03-01'
GO
SELECT orderdate,SalesOrderid FROM SalesOrderheader WHERE
orderdate='2007-12-01'
参数化查询 可能会导致过滤索引失效