Solved

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

Posted on 2014-07-31
2
127 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

20 Experts available now in Live!

Get 1:1 Help Now