USE pubs
GO
/*表:authors 列:phone 索引:IX_cxphone*/
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_cxphone')
DROP INDEX authors.IX_cxphone
/*--笔试列创建非聚集索引:填充因子为 30%--*/
CREATE NONCLUSTERED INDEX IX_cxphone
ON authors(phone)
WITH FILLFACTOR= 30
GO
/*-----指定按索引 IX_cxphone 查询----*/
SELECT * FROM authors WITH (INDEX=IX_cxphone) WHERE phone LIKE '408%'
GO
/*表:authors 列:phone 索引:IX_cxphone*/
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_cxphone')
DROP INDEX authors.IX_cxphone
/*--笔试列创建非聚集索引:填充因子为 30%--*/
CREATE NONCLUSTERED INDEX IX_cxphone
ON authors(phone)
WITH FILLFACTOR= 30
GO
/*-----指定按索引 IX_cxphone 查询----*/
SELECT * FROM authors WITH (INDEX=IX_cxphone) WHERE phone LIKE '408%'