Solved

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

Posted on 2014-07-31
2
134 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:
Scott Pletcher 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS SQL + Insert Into Table - If Doesnt Exist 9 61
Stored Proc - Rewrite 42 73
Adding SQL Server Browser in after install is complete 8 35
SQL Select Query help 1 38
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

697 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