Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
SQL
ce
clients
clustering
connect
datamining
datawarehouse
dts
fulltext
jdbcdriver
msde
mseq
newusers
notificationsvcs
odbc
olap
programming
replication
reportingsvcs
security
securitytools
server
setup
sqlxml.viewmapper
tools
xml
  
 
date: Mon, 4 Feb 2008 07:12:03 -0800 (PST),    group: microsoft.public.sqlserver.ce        back       


How do I change sort order when all numeric values are in a text field?   
I have this SQL:

Select ta_point from tblTally Group By ta_point

which gives:

1
10
2
21

etc

All values are numeric but it is a NVARCHAR field.

I tried:

Select ta_point from tblTally Group By ta_point Order By ta_point
which does not change results

Select convert(float, ta_point) from tblTally Group By ta_point Order
By ta_point which does not work

How do I do this to get:

1
2
10
21

Thanks

Mad Ape
date: Mon, 4 Feb 2008 07:12:03 -0800 (PST)   author:   The Mad Ape

Re: How do I change sort order when all numeric values are in a text field?   
How about something like this:

SELECT CONVERT(float, ta_point) AS SortPoint from tblTally ORDER BY 
SortPoint
-- 
Erik Ejlskov Jensen, Mobile App Dev MCTS
Check out my SQL Compact blog at
http://erikej.blogspot.com

"The Mad Ape"  wrote in message 
news:c5b2040e-0997-439a-8553-f359ca9254be@n20g2000hsh.googlegroups.com...
>I have this SQL:
>
> Select ta_point from tblTally Group By ta_point
>
> which gives:
>
> 1
> 10
> 2
> 21
>
> etc
>
> All values are numeric but it is a NVARCHAR field.
>
> I tried:
>
> Select ta_point from tblTally Group By ta_point Order By ta_point
> which does not change results
>
> Select convert(float, ta_point) from tblTally Group By ta_point Order
> By ta_point which does not work
>
> How do I do this to get:
>
> 1
> 2
> 10
> 21
>
> Thanks
>
> Mad Ape
date: Mon, 4 Feb 2008 17:59:42 +0100   author:   ErikEJ

Re: How do I change sort order when all numeric values are in a text field?   
On Feb 4, 12:59 pm, "ErikEJ"  wrote:
> How about something like this:
>
> SELECT CONVERT(float, ta_point) AS SortPoint from tblTally ORDER BY
> SortPoint
> --
> Erik Ejlskov Jensen, Mobile App Dev MCTS
> Check out my SQL Compact blog athttp://erikej.blogspot.com


It works great.

Thanks.

The Mad Ape
www.tatumba.com
date: Mon, 4 Feb 2008 09:48:24 -0800 (PST)   author:   The Mad Ape

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us