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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 convert float to formatet string
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

35 Posts

Posted - 02/05/2013 :  15:26:49  Show Profile  Reply with Quote
I want to convert float values ??in Char-format (5.2)
3 digits before / 2 digits after. Without dot or comma and leading zero-values??:

0.12 = 00012
2.3 = 00230
12.3 = 01230
123.4 = 12340
2 = 00200
NULL = 00000

and on so ....

Thank you

Edited by - gpc44 on 02/05/2013 15:37:01

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 02/05/2013 :  16:27:50  Show Profile  Reply with Quote
RIGHT('00000'+CAST(CAST(100*ISNULL(YourNumberColumn,0) AS DECIMAL(18,0))AS VARCHAR(32)),5)

Edited by - James K on 02/05/2013 19:04:49
Go to Top of Page

Premature Yak Congratulator

22864 Posts

Posted - 02/08/2013 :  07:25:19  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
If you want to show these in front end application, do the formation there


Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000