View Single Post
  #4 (permalink)  
Old 04-20-09, 11:08
Wim Wim is offline
Registered User
 
Join Date: Nov 2004
Posts: 1,159
If DEX_ROW_ID is an identity column, its values will be in the order of creation. In most cases it will be safe to use it in your ORDER BY clause.
Quote:
After several test I found that if I sort using DEX_ROW_ID, I'll get the order order.
As you already stated, in your case it will work.

A better design would keep an extra column like InvoiceLineNr (or some similar name), to store the sequence explicitly. Perhaps some column with that name is present?
__________________
With kind regards . . . . . SQL Server 2000/2005/2008/2008 R2 Earned beers: 13
Wim
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
Reply With Quote