Solved

Column to show as %

Posted on 2014-01-16
3
243 Views
Last Modified: 2014-01-16
I have the following code
 
select dbo.test.GISHEXID,cast((dbo.test.Total_HH)as float)/cast((dbo. V_Master_Hex.Total_Households)as float) as Served_Percent,

Open in new window

.

I was hoping to show this column results as a percentage for my boss.
am I missing something? everything comes out as 4.0455555 this iwould like to see as 24% .
Thanks
0
Comment
Question by:PtboGiser
3 Comments
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 39785828
Looks like the values might be upside down in the divide:

select dbo.test.GISHEXID,(cast(dbo.V_Master_Hex.Total_Households as float) * 100)/cast(dbo.test.Total_HH as float) as Served_Percent
0
 
LVL 2

Expert Comment

by:BarryMcGillin
ID: 39785842
Assuming the math is correct and the value for the total households is greater than the test number of house holds you should get a 0.0 to 1.0 number which you can make a percentage.
For rough percentages you dont need the cast either, which will leave you with integer values 1..100
0
 

Author Closing Comment

by:PtboGiser
ID: 39785867
Thanks
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now