|
Adding a column to a table at a particular location Posted: 13 Mar 2008 10:04 AM |
Has anyone tried to add a column at a particular location without the old ...
1. create a temp table based on the original with the columns in the sequence you wish,
2. copy data across
3. delete original table
4. rename new table as original
I (vaguely) recall the ability to modify the column ordering via updates to the sys tables. Is this (still) possible (by either T-SQL or CLR programming)?
All help appreciated.
John |
|
|
 |
|
urid
|
 |
| Joined: 18 Jun 2007 |
| Total Posts: 34 |
| |
|
Re: Adding a column to a table at a particular location Posted: 13 Mar 2008 11:17 PM |
Dear John
You cannot do that without re-creating a table. May I ask you, why it is important to you?
It is not recommended modifying system tables, do not do that. |
Best Regards,
Uri Dimant
SQL Server MVP
http://dimantdatabasesolutions.blogspot.com/
|
|
 |
|
|
Re: Adding a column to a table at a particular location Posted: 14 Mar 2008 12:34 PM |
I've been asked to add columns at a particular location (ie, within the existing columns). I am personally against this but....
|
|
|
 |
|
|
Re: Adding a column to a table at a particular location Posted: 31 Jul 2008 09:30 AM |
Sorry about the long delay, but I finally managed to do this.
And thanks Uri. I did follow your recmomendation of creating a temporary table with the new definition, then copying data across, and then renaming it. Of course, contraints and FKs were troublesome.
|
|
|
 |
|