|
---- Create Basic Index
CREATE INDEX myIndex
ON myTable
(
myField
)
GO
---- Create Unique Nonclustered Index
USE AdventureWorks
GO
CREATE UNIQUE NONCLUSTERED INDEX AK_EmployeeAddress_rowguid
ON HumanResources.EmployeeAddress
(
rowguid ASC
)
WITH
(
SORT_IN_TEMPDB = OFF,
DROP_EXISTING = OFF
)
ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty
@name=N'MS_Description',
@value=N'Description of index' ,
@level0type=N'SCHEMA',
@level0name=N'HumanResources',
@level1type=N'TABLE',
@level1name=N'EmployeeAddress',
@level2type=N'INDEX',
@level2name=N'AK_EmployeeAddress_rowguid'
GO
|