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
 Adding Percent symbol

Author  Topic 

JJ297
Aged Yak Warrior

940 Posts

Posted - 2012-02-23 : 07:51:16
How would I add the % to my code below? I want the results to be 8.1% in the database.


"percOver300" =
Case
when sum(pendinfo) = 0 then 0
when sum(pendfo300) = 0 then 0
Else
(convert(decimal(6,1),((((sum(pendfo300)) * 1.00) / sum(pendinfo)) * 100)))
En

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-02-23 : 08:02:54
Why do you want to do that ? This is more of a presentation issue and should be performed at the front end where the data is display.

In order to do that you will have to store your value in string / varchar. And this makes accessing to the value or any computation not efficient.


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

Go to Top of Page

JJ297
Aged Yak Warrior

940 Posts

Posted - 2012-02-23 : 08:11:08
Okay thanks I will store it on the front end instead. Thanks.
Go to Top of Page

JJ297
Aged Yak Warrior

940 Posts

Posted - 2012-02-23 : 08:39:40
Thanks I added this to the front end {0:0.0#\%}
Go to Top of Page
   

- Advertisement -