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
 convert float to formatet string

Author  Topic 

gpc44
Starting Member

35 Posts

Posted - 2013-02-05 : 15:26:49
Hello,
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
reagards
Nicole

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-02-05 : 16:27:50
[code]RIGHT('00000'+CAST(CAST(100*ISNULL(YourNumberColumn,0) AS DECIMAL(18,0))AS VARCHAR(32)),5)[/code]
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2013-02-08 : 07:25:19
If you want to show these in front end application, do the formation there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -