Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-06-19 : 12:23:46
|
| Tony writes "I have a table with a long list of columns and I would like to remove a column and replace it with 2 new ones. No default or constraint necessary.But can I insert the new columns into the same location to keep the order of the columns logical?The standard ALTER TABLE ADD simply adds it to the end?Tony" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2002-06-19 : 12:27:28
|
| not really......you can create a new table using Select Into (if required to transfer the data) and then drop the old table and rename the new one.....the order the columns are saved in the database has no effect on the performance of the queries....it's more of an aesthetic thing!!! |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-06-19 : 13:58:49
|
quote: the order the columns are saved in the database has no effect on the performance of the queries....it's more of an aesthetic thing!!!
Mostly true, but not always. In particular SQL Server will not "fill" a byte in a page w/ more than one bit column unless the bit columns are next to each other. So, for example, in a table w/ 16 columns, 8 bits and 8 tinyints, for example, i could have a row with a width of 9 bytes, putting all 8 bits together, or 16 bytes, by alternating them in the table. The effect of a larger row size is fewer rows per page, which means more I/O to read the same amount of data and ultimately means slower performance.setBasedIsTheTruepath<O> |
 |
|
|
|
|
|