I know that if I want to make a copy of a SQL Server table, I can write a query akin to this:
SELECT *
INTO NewTable
FROM OldTable
But what if I wanted to take the contents of OldTable
that may look like this:
| Column1 | Column2 | Column3 |
|---------|---------|---------|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
and make a copy of that table but have the new table look like this:
| Column1 | Column3 | Column2 | Column4 | Column5 |
|--------- |--------- |--------- |--------- |--------- |
| 1 | 3 | 2 | 10 | 11 |
| 4 | 6 | 5 | 12 | 13 |
| 7 | 9 | 8 | 14 | 15 |
So now I've swapped Columns 2 and 3 and added Column 4 and Column 5. I don't need to have a query that will add that data to the columns, just the bare columns.