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?