Insert column AFTER RRS feed

  • Question

  • I want to insert a new column into a table of a datagrid.

    This is ok: sqlname = "ALTER TABLE " & tablename & " ADD column1 VARCHAR(4)" It inserts a column at the end of the table, but I want to insert at a certain position. Adding "AFTER xy" I get a syntax error. 

    Thank you for an answer.

    Tuesday, July 6, 2010 2:03 PM


  • If you are using SQL Server I don't believe that this is possible without copying the data to a temp table, dropping columns, adding columns in the desired order and then copying the data back.

    In any event, you can put the columns in any order you wish using a SQL SELECT statement so I'm not sure why this would be important.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Proposed as answer by VMazur Wednesday, July 7, 2010 10:32 AM
    • Marked as answer by Alex Liang Tuesday, July 13, 2010 8:17 AM
    Tuesday, July 6, 2010 2:44 PM