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 |
|
Rita Bhatnagar
Posting Yak Master
172 Posts |
Posted - 2002-03-08 : 13:33:57
|
| If i write the statement like that i don't get result in any orderSELECT DISTINCT Left(awp.tradename,1) AS LettFROM AWP But when i use the statement below i get result in ascending orderSELECT DISTINCT Left(awp.tradename,1) AS LettFROM AWP where Left(awp.tradename,1)<>''What's going on? |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-03-08 : 13:53:31
|
| without an ORDER BY, the order of the rowset is indeterminate. It may be "ordered" in some fashion today, but it can change as SQL Server shuffles pages around due to deletes, clustered index changes, etc.Don't rely on it, use ORDER BY explicitly. |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2002-03-08 : 13:54:59
|
| doing a <>'' will order as it takes into account any indexes on the table, run a trace or query plan and you will see this... |
 |
|
|
|
|
|