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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Trying to get percent returned

Author  Topic 

henryparsons10
Starting Member

23 Posts

Posted - 2008-06-05 : 14:48:06
I am trying to divide two statements...

Like this

count(table.column)/count(table.column) As Percentage

My return set is either a '1' or a '0'

So, it only returns 1 where the formula equals 100 (percent in this case) and it is returning 0 for all other. I am assuming it is only returning the whole number without any decimal. I really want to get the data as a percent.

Can anyone help.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-05 : 14:51:17
1.0*count(table.column)/count(table.column) As Percentage

Madhivanan

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-06 : 10:43:52
Madhi has written a blog on this:-

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-06 : 11:23:33
quote:
Originally posted by visakh16

Madhi has written a blog on this:-

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx


Thanks. I forgot to specify that

Madhivanan

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

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-06 : 12:03:43
quote:
Originally posted by madhivanan

quote:
Originally posted by visakh16

Madhi has written a blog on this:-

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx


Thanks. I forgot to specify that

Madhivanan

Failing to plan is Planning to fail


You're welcome Madhi
Glad to see you back in full form
Go to Top of Page
   

- Advertisement -