Crie um índice não exclusivo não clusterizado na instrução CREATE TABLE com o SQL Server
É possível criar uma chave primária ou índice exclusivo em uma instrução CREATE TABLE do SQL Server. É possível criar um não exclusivo index dentro de uma instrução CREATE TABL
CREATE TABLE MyTable(
a int NOT NULL
,b smallint NOT NULL
,c smallint NOT NULL
,d smallint NOT NULL
,e smallint NOT NULL
-- This creates a primary key
,CONSTRAINT PK_MyTable PRIM,ARY KEY CLUSTERED (a)
-- This creates a unique nonclustered index on columns b and c
,CONSTRAINT IX_MyTable1 UNIQUE (b, c)
-- Is it possible to create a non-unique index on columns d and e here?
-- Note: these variations would not work if attempted:
-- ,CONSTRAINT IX_MyTable2 INDEX (d, e)
-- ,CONSTRAINT IX_MyTable3 NONCLUSTERED INDEX (d, e)
);
GO
-- The proposed non-unique index should behave identically to
-- an index created after the CREATE TABLE statement. Example:
CREATE NONCLUSTERED INDEX IX_MyTable4 ON MY_TABLE (d, e);
GO
Novamente, o objetivo é criar o índice não exclusivo dentro da instrução CREATE TABLE, não depois del
Pelo que vale a pena, não encontrei o [Entrada online do SQL Server Books para CREATE TABLE] para ser útil.
Além disso,[Essa questão é quase idêntico, mas a resposta aceita não se aplic