Solved

not able to rearrange the columns if it had the ALTER TABLE INDEX

Posted on 2014-07-31
2
128 Views
Last Modified: 2014-08-07
when a table has the below kind of index (with a WHERE), then it does not allow me to rearrange the order of columns, unless i drop the index first. is there a way to disable this need?

CREATE UNIQUE NONCLUSTERED INDEX ix_abc
 ON tablename (Columname) WHERE Columname IS NOT NULL
0
Comment
Question by:25112
2 Comments
 
LVL 21

Expert Comment

by:Randy Poole
ID: 40231928
why do you care what order the columns are in?
0
 
LVL 69

Accepted Solution

by:
ScottPletcher earned 500 total points
ID: 40232075
SQL does not have a direct method of adding a column in a given location in the table.  SSMS (SQL's gui) adds a column in a given location, but it does it by copying the data out, recreating the table (essentially), and copying the data back in.  Given that, yes, there are index restrictions, but you're much better off dropping such indexes before that and re-creating them afterward anyway with all that data copying going on.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now