May 26, 2009 at 7:26 am
The order by clause is affected by a special character , "(", in the column, which messes up the ordering sequence. The order by results I get from the below query:
select MyColumn 1
from MyTable
order by MyColumn 1
is:
ka(e)
ka(r)
ka(u)
kai
The results needed is:
ka(e)
kai
ka(r)
ka(u)
Is there anyway to get the desired results, which would mean getting an order by result not affected by the first bracket, "(" ?
Much appreciated!
May 26, 2009 at 7:38 am
order by replace(MyColumn 1,'(','')
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537May 26, 2009 at 7:38 am
select MyColumn
from MyTable
order by REPLACE(MyColumn,'(','')
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
May 26, 2009 at 7:54 am
Old Hand, GilaMonster-Simply thank you!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply