Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 order string field

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2011-01-05 : 11:52:32
Hi All

I have varchar(10) field with values:
12.25
452.3
v53
82
v12.54


and I would like to order it in ascending order. I want the output like this
12.25
82
452.3
v12.54
v53

If it is possible how it to do?

Thanks

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-01-05 : 12:08:21
order by case when fld like 'v%' then 1 else 0 end, convert(float,replace(fld,'v',''))


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-08 : 01:49:49
hope you'll not have any other characters coming inside values

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -