May 28, 2003 at 11:48 am
how can i add a column to a table at specified order using T-SQL?
like a content table with 4 columns:
tablename--CONTENT
column1--id
column2--title
column3--topic
column4--content
now, i wolud like to add a column5 between
column2 and column3. how?
thanks!!!
May 28, 2003 at 11:59 am
You can add column at bottom and select them in the sequence as you like.
If you really want to add column in sequence, recreate your table.
Edited by - Allen_Cui on 05/28/2003 12:00:06 PM
June 6, 2003 at 12:30 am
Enterprise Manager's "Design Table" function has the ability to insert a column anywhere in the table rather than just at the end as an ALTER TABLE would do. BUT BEWARE, I don't suggest doing this for a large table, especially on a production database. Enterprise Manager hasn't got a magic way of acheiving this... under the covers it's creating a copy of the original table, re-creating the table with the revised design and then moving all the data back in. Do it on a large table and you can bring the server to its knees.
Cheers,
- Mark
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply