Sunday, February 19, 2012

Add column in middle of table

Hi all,
Is it possible to add a column to a table in a particular position? For
instance, if I had a table with columns A, B, D, E and I want to insert a
new column called 'C' but I want it to be added between columns B and D
instead of at the end of the table, is this possible? Thanks!Sure, use Enterprise Manager. It has this great technique of making a copy
of your table with the new column, copying all the data over, a fancy
rename, and don't forget moving all the constraints and permissions.
Or, stop worrying about ordinal position (there is no "end" of a table,
IMHO). Column order is irrelevant. If you have code that relies on it, fix
the code.
http://www.aspfaq.com/2478
This is my signature. It is a general reminder.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.

> Is it possible to add a column to a table in a particular position? For
> instance, if I had a table with columns A, B, D, E and I want to insert a
> new column called 'C' but I want it to be added between columns B and D
> instead of at the end of the table, is this possible? Thanks!

No comments:

Post a Comment