all groups > sql server connect > august 2006 >
You're in the

sql server connect

group:

in sql server 2000 when you issue a alter table to add new column, can you specifiy the order? meaning i want that column to be between existing colum



in sql server 2000 when you issue a alter table to add new column, can you specifiy the order? meaning i want that column to be between existing colum Daniel
8/22/2006 12:45:31 PM
sql server connect: in sql server 2000 when you issue a alter table to add new column, can you
specifiy the order? meaning i want that column to be between existing
columns, not at the last

Re: in sql server 2000 when you issue a alter table to add new column, can you specifiy the order? meaning i want that column to be between existing c Arnie Rowland
8/22/2006 1:08:06 PM
In Query Analyzer you cannot specify the column order with an ALTER
statement.

In a well designed application, column order will NOT be a problem since ALL
queries will specify the column order instead of using [SELECT *].

If you MUST (and it is really, really silly and a sign of laziness) to be
concerned about the table/column order,

In Query Analyzer:
CREATE a new table
COPY the data in the old table to the new table
DROP the old table
May require DROP FK constraints on child tables
RENAME the new table to the old table name
re-CREATE ALL indexes on the new table
re-CREATE ALL constraints on the new table
re-CREATE FK constraints on child tables if necessary.

In Enterprise Manager, Using the designer, change the column order. EM will
do all of the above for you. HOWEVER, it the database is in production,
and/or is very large, it may be very disruptive and take a long time to
complete.

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


[quoted text, click to view]

Re: in sql server 2000 when you issue a alter table to add new column, can you specifiy the order? meaning i want that column to be between existing c Scott Morris
8/22/2006 3:57:51 PM
[quoted text, click to view]

Answered in another NG - please do not post the same question independently
to multiple newsgroups.

AddThis Social Bookmark Button