April 20, 2011 at 1:19 am
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]
April 20, 2011 at 2:06 am
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
April 20, 2011 at 3:38 am
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