February 24, 2009 at 9:23 am
I have a table in which the first two entries must always be particular parameters and then after that order doesn't matter. But when I add to this table, I see the new rows are getting put at the top of the table and not at the bottom. I've never seen this behavior on any other table of my database and find it very difficult to get around. What would cause this?
I read somewhere that deletions and reinserts sometimes use the same rows as before.
February 24, 2009 at 9:38 am
The order of rows in a table isn't supposed to matter in a relational database. You have to query it, using Order By, to force the rows to have a specific order.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 24, 2009 at 9:42 am
Mindy Hreczuck (2/24/2009)
I have a table in which the first two entries must always be particular parameters and then after that order doesn't matter.
Rows in a table have no defined order. That's per relational theory. A table is an unordered set of rows.
If you want an order when you query the table, use an appropriate ORDER BY clause
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
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply