2 out of 7 rated this helpful - Rate this topic

CREATE INDEX (Windows Azure SQL Database)

Creates a relational index on a specified table or view on a specified table. An index can be created before there is data in the table. Relational indexes can be created on tables or views in another database by specifying a qualified database name.

noteNote
Because Microsoft Windows Azure SQL Database does not support heap tables, a table must have a clustered index. If a table is created without a clustered constraint, a clustered index must be created before an insert operation is allowed on the table.

Syntax Conventions (Windows Azure SQL Database)


CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name 
    ON <object> (column [ ASC | DESC ] [ ,...n ] ) 
    [ INCLUDE (column_name [ ,...n ] ) ]
    [ WHERE <filter_predicate> ]
    [ WITH ( <relational_index_option> [ ,...n ] ) ]


[ ; ]

<object> ::=
{
    [ database_name. [ schema_name ] . | schema_name. ] 
    table_or_view_name
}

<relational_index_option> ::=
{
  | IGNORE_DUP_KEY = { ON | OFF }
  | STATISTICS_NORECOMPUTE = { ON | OFF }
  | DROP_EXISTING = { ON | OFF }
  | ONLINE = { ON | OFF }
}

<filter_predicate> ::= 
    <conjunct> [ AND <conjunct> ]

<conjunct> ::=
    <disjunct> | <comparison>

<disjunct> ::=column_name IN (constant ,…)

<comparison> ::=column_name <comparison_op> constant<comparison_op> ::=
    { IS | IS NOT | = | <> | != | > | >= | !> | < | <= | !< }




This syntax diagram demonstrates the supported arguments and options in Windows Azure SQL Database.

Windows Azure SQL Database does not support the following arguments and options with the CREATE INDEX statement:

  • ON Keyword for

    • partition_schema_name

    • filegroup name

    • default

  • FILESTREAM_ON

  • relational_index_option:

    • PAD_INDEX

    • FILLFACTOR

    • SORT_IN_TEMPDB

    • ALLOW_ROW_LOCKS

    • ALLOW_PAGE_LOCKS

    • MAXDOP

    • DATA_COMRESSION

  • Backward-compatible relational index

noteNote
Windows Azure SQL Database supports the three-part name format database_name.[schema_name].object_name when the database_name is the current database or the database_name is tempdb and the object_name starts with #.

Windows Azure SQL Database does not support four-part names.

For more information about the arguments and the CREATE INDEX statement, see CREATE INDEX (Transact-SQL) in SQL Server Books Online.

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.