1

I have a table with two columns that I'd like to swap. I want the column with index 5 to be swapped with the column with index 4. This post from 2013 suggests this might not be possible. Is there a way to do this now?

I am currently using SQLite Manager plugin for Firefox.

artumi
  • 105
  • 8
  • 2
    The order of columns in a table is irrelevant. Why do you think you need to do that? –  May 20 '16 at 11:41
  • Because we have a large iOS project where every `SELECT` statement would need updating – artumi May 20 '16 at 11:55
  • @artumi then change your program. Column index should not be an issue, so if your queries need changing (because for some reason it is) then I suggest you do that now and treat it as a learning exercise. – Takarii May 20 '16 at 13:10

1 Answers1

1

you can do it but with the using of creating new table from existing table.

step 1 SELECT col1,col2,col3,col5,col4 INTO #tab1 FROM tab

step 2 rename the table tab to tab2

step 3 rename tab1 to tab

this process might help you.

but if you move column in existing table there is possibility to corrupt the data.

Sanjay
  • 342
  • 2
  • 9