If something happens to go in that column that isn't a number its gonna error 
cause it cant convert alpha chars to numbers

If your on MSSQL you might have to look at the REPLACE() function to strip out 
everything but the numbers so it doesn't error

Steve

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of grant
Sent: Thursday, February 03, 2005 3:46 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: kinda OT: sql

Thanks heaps Scott - it didn't work but pointed me in the right
direction. the solution was:

SELECT     CONVERT(numeric(18, 2), DocNo) AS Expr1
FROM         tbl_Documents
ORDER BY Expr1

Thanks again
G


On Thu, 03 Feb 2005 15:33:53 +1100, Scott Thornton
<[EMAIL PROTECTED]> wrote:
> order by
> convert(numeric(18,2), fieldname)
> 
> ??
> 
> >>> [EMAIL PROTECTED] 3/02/2005 3:03:49 pm >>>
> hi everybody!
> 
> this is OT, point me to the right place if it offends thee...
> 
> my question is this:
> what's the quick and dirty way of forcing a numeric sort on a varchar
> column?
> 
> background {
>   sqlserver, mx04
>   i have a 'documentNo' that can be a number or string. they are
> getting stored into a varchar column, and ORDER BY is producing ascii
> sorted results - 1.10 ('one point ten') comes before 1.2 - which is
> undesired
> }
> 
> cast?
> any syntax examples would be greatly appreciated?
> 
> thx
> Grant
> 
> ---
> You are currently subscribed to cfaussie as:
> [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
>

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/


---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to