How to alter the index in sql server 2005

  • I am using SQL server 2005.

    I have one existing index created on a table.

    This UNIQUE NONCLUSTERED INDEX is defined on one column EID at present but i want to add one more column PID to this existing index.

    How i can alter the below index? Any help is appreciated.

    CREATE UNIQUE NONCLUSTERED INDEX [TBL1_IDX1] ON [dbo].[TBL1]

    (

    [EId] ASC

    )WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]

  • DROP INDEX ....

    CREATE UNIQUE INDEX ...

    or

    CREATE UNIQUE INDEX ....

    WITH DROP_EXISTING

    You cannot alter an index to add a column

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks SSC.

    Yes i also find that this is the only way to add new column to index.

    I dropped it first and then recreated with adding new column.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply