Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Unanswered: Insert new column into a table at a particular position

    TAB1 structure
    Name Age Gender Address rank
    Inserting a new column to a table say ‘TAB1’ can be done by …

    Alter table TAB1 add column1 varchar(20).
    [which appends a column to the end]

    I need to insert a column at a particular position say .. after ‘Age’ column … How do I do that ??

  2. #2
    Join Date
    Nov 2002
    within an RDBMS column positions have no meaning ...
    adding columns to a particular table appends always

    if you want - for whatever reason - have your columns ordered either coin a view or you must go for

    rename the <table> to <tmp_table>
    create the table <table> with your ordered column list
    insert into <table> (columnlist) as select columnlist from tmp_table
    drop tmp_table

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts