July 11, 2008 at 1:45 pm
What is the best practice for the order of columns with a datatype of varchar in a table? Should they be placed last in a table in ascending order or it doesn't matter?
July 11, 2008 at 3:01 pm
Makes no difference. The order you specify the columns just determines the columnIDs, no guarantees that the columns will actually be stored in that order in the data pages.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 11, 2008 at 5:18 pm
The position of variable length made a difference about 15 years ago with version 6.0 but not with any of the current version.
SQL = Scarcely Qualifies as a Language
July 15, 2008 at 10:11 am
I agree with the other replies.
Just for info, when a row is physically stored (in 2005) in the page the following sequence is used:-
* First, the Header,
* Followed by Fixed Columns,
* Then Null Columns,
* Then Variable Column Pointers,
* Then Variable Column Data.
This sequence is always followed irrespective of the order in which the columns are defined (as the previous replys have said).
July 15, 2008 at 1:10 pm
Thanks everyone for their replies!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply