numeric datatypes that cant be sorted

rgb192
rgb192 used Ask the Experts™
on
i have sorted a datatype  (forget which datatype) where
sorts
1
23
5
6
740030
86
9


instead of
1
5
6
9
23
86
740030
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Awarded 2008
Awarded 2008

Commented:
order by cast(fieldname as int)
Order by cast(fieldname as nvarchar(100))

Author

Commented:
i dont want to order by cast

I just wan to know the datatype that does this and to avoid it
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

what is the current datatype of the field
Awarded 2008
Awarded 2008
Commented:
it is a varchar field...which is why it is sorting that way.  You'll only be able to sort numerically if you cast it to a numeric data type.

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial