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
 leading 0
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pille
Starting Member

15 Posts

Posted - 05/13/2011 :  06:06:26  Show Profile  Reply with Quote
hallo all

i have a table but the result isnt what i expect.
a simple sql statement select row from table
gives back:
select * from table

xxx 100 20110503 .25865
xxx 100 20110503 19.6163773
xxx 100 20110503 17.26035

as you can see the value .25865 should be shown as 0.25865.
the last row is a number field.
how do i get the leading 0 in it if nothing is written there

thank you for hints

khtan
In (Som, Ni, Yak)

Singapore
17584 Posts

Posted - 05/13/2011 :  06:10:59  Show Profile  Reply with Quote
What you see now is just the way query window display the numeric value. Don't have to worry about that.

For presentation and formatting of the value, should do it in your reporting tool or front end application.


KH
Time is always against us

Go to Top of Page

pille
Starting Member

15 Posts

Posted - 05/13/2011 :  06:15:03  Show Profile  Reply with Quote
quote:
Originally posted by khtan

What you see now is just the way query window display the numeric value. Don't have to worry about that.

For presentation and formatting of the value, should do it in your reporting tool or front end application.



thanks for your replay
the output needs to be exported as excel file. in the excel is also without 0. the excel will be used for manual reporting (at the moment). also i dont want as less as possible human interaction. it needs to be possible to output to manipulate that the result could export directly in excel and could be used. any ideas please ??
i tried the "case" command but did not get a positive result.
thanks
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17584 Posts

Posted - 05/13/2011 :  06:24:37  Show Profile  Reply with Quote
then do the formatting at the excel end, format cell something . . . .


KH
Time is always against us

Go to Top of Page

pille
Starting Member

15 Posts

Posted - 05/13/2011 :  07:30:47  Show Profile  Reply with Quote
quote:
Originally posted by khtan

What you see now is just the way query window display the numeric value. Don't have to worry about that.

For presentation and formatting of the value, should do it in your reporting tool or front end application.



thanks for your replay
the output needs to be exported as excel file. in the excel is also without 0. the excel will be used for manual reporting (at the moment). also i dont want as less as possible human interaction. it needs to be possible to output to manipulate that the result could export directly in excel and could be used. any ideas please ??
i tried the "case" command but did not get a positive result.
thanks
Go to Top of Page

pille
Starting Member

15 Posts

Posted - 05/13/2011 :  08:02:43  Show Profile  Reply with Quote
quote:
Originally posted by pille

quote:
Originally posted by khtan

What you see now is just the way query window display the numeric value. Don't have to worry about that.

For presentation and formatting of the value, should do it in your reporting tool or front end application.



thanks for your replay
the output needs to be exported as excel file. in the excel is also without 0. the excel will be used for manual reporting (at the moment). also i dont want as less as possible human interaction. it needs to be possible to output to manipulate that the result could export directly in excel and could be used. any ideas please ??
i tried the "case" command but did not get a positive result.
thanks



for whom which are interested on the solution


select
table_name.row1 as name1,
table_name.row2 as name2,
table_name.row3 as name3,
rtrim (to_char (table_name.row4, 'B99999999999999999999990.99999999999999999'), '0') as name4
from table_name

so it works and the output is loke expected
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17584 Posts

Posted - 05/13/2011 :  09:58:05  Show Profile  Reply with Quote
TO_CHAR ? You must be in the wrong forum. This site is for Microsoft SQL Server.


KH
Time is always against us

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22742 Posts

Posted - 05/16/2011 :  09:12:26  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Post your question at www.orafaq.com

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.08 seconds. Powered By: Snitz Forums 2000