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
 leading 0

Author  Topic 

pille
Starting Member

15 Posts

Posted - 2011-05-13 : 06:06:26
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)

17689 Posts

Posted - 2011-05-13 : 06:10:59
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
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pille
Starting Member

15 Posts

Posted - 2011-05-13 : 06:15:03
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)

17689 Posts

Posted - 2011-05-13 : 06:24:37
then do the formatting at the excel end, format cell something . . . .


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pille
Starting Member

15 Posts

Posted - 2011-05-13 : 07:30:47
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 - 2011-05-13 : 08:02:43
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)

17689 Posts

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


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-05-16 : 09:12:26
Post your question at www.orafaq.com

Madhivanan

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

- Advertisement -