Solved

How can I get [select 27/30] to return .09 instead of 0?

Posted on 2008-10-17
3
165 Views
Last Modified: 2010-03-19
In SQL Server (version 2005 if it even matters), how do I get this division to return the value of .9 instead of 0?

SELECT 27/30

I tried casting and converting to decimal/numeric to no avail.
0
Comment
Question by:reallyv
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
Marcjev earned 125 total points
ID: 22742197
do
select 27.0 / 30

or

select convert(float,27)/30

so make the type not int...
0
 
LVL 10

Expert Comment

by:Marcjev
ID: 22742209
if you only convert the result, the int division has already taken place and you actually convert the zero...
0
 

Author Comment

by:reallyv
ID: 22742758
Thank you thank you!
0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQl Agent job fails--SSIS package looses password 6 58
SQL Server Degrading on Write 13 72
Email Notifications for SQL 2005 9 38
Parse this column 6 35
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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