SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

gpc44
Starting Member

35 Posts

Posted - 02/05/2013 :  15:26:49  Show Profile  Reply with Quote
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

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

James K
Flowing Fount of Yak Knowledge

3742 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

madhivanan
Premature Yak Congratulator

India
22769 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

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000