Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add column to table

Status
Not open for further replies.

daproud

Technical User
Nov 2, 2000
5
US
I need to add a column to an existing table that contains data. This column will also become part of a concatanated primary key for the table. I would like to put this column next to the other columns that make up the key. I know I need to export out the table, drop the table, change the CREATE DDL and recreate it. But how do I import the data back in so it will file in the correct columns? Since my export did not contain the new. Is export the correct method of doing this is or is there a better way?
Thanks for any help or advice.
 
Hi.
Use ALTER TABLE yourTable ADD (yourColumn dataType); if the "location" of the column is not your main issue. You can also RENAME the table, then CREATE TABLE xxx AS SELECT - no need for export.

Stefan
 
Hi,
IIRC,in most cases ( maybe all cases ), the 'location' of a data field within a table has little if any impact on performance..For space management I have read that likely NULLs should be at the end.
I create my tables with fields in alpha order to make it easier for my users to select the ones they want when selecting them from a drop down list.

[profile]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top