View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 06:27 PM
Erland Sommarskog
 
Posts: n/a
Default Re: sorting Conundrum

Fraggle (Fraggle_Rock_1@yahoo.com) writes:
> I have a table that has this as data
>
> aa, Aa and AA
>
> I would like to be able to sort on this row so I get
>
> aa
> aa
> Aa
> Aa
> AA
> AA
>
> or the reverse, how do i go about this?
>
> SELECT [Arow]
> FROM [aTable]
> ORDER BY [Arow]
>
> I get them returned in the order they were entered into the db.


You need to use a case-sensitive collation, and your server appears
to have a default collation which is case-insensitive.

You can add a COLLATE clause:

ORDER BY Arow COLLATE Latin1_General_CS_AS

Note: this only works on SQL 2000.

--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Reply With Quote