CREATE NONCLUSTERED INDEX IX_a ON dbo.a
(
id
)

解决方案 »

  1.   

    CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
        ON { table | view } ( column [ ASC | DESC ] [ ,...n ] ) 
    [ WITH < index_option > [ ,...n] ] 
    [ ON filegroup ]< index_option > ::= 
        { PAD_INDEX |
            FILLFACTOR = fillfactor |
            IGNORE_DUP_KEY |
            DROP_EXISTING |
        STATISTICS_NORECOMPUTE |
        SORT_IN_TEMPDB  下面的示例为 authors 表的 au_id 列创建索引。SET NOCOUNT OFF
    USE pubs
    IF EXISTS (SELECT name FROM sysindexes 
          WHERE name = 'au_id_ind')
       DROP INDEX authors.au_id_ind
    GO
    USE pubs
    CREATE INDEX au_id_ind
       ON authors (au_id)
    GO
      

  2.   

    使用唯一聚集索引CREATE UNIQUE CLUSTERED INDEX employeeID_ind
       ON emp_pay (employeeID)
    GO