Solved

Dividing one int type column by another int column and returning a numeric value for a list

Posted on 2012-03-14
1
310 Views
Last Modified: 2012-03-14
How is the best way to divide an int column by another int column and returning a numeric value for a set of records (one operation per row) such as

select col1, col2, col2/col1 * 100 as col3
0
Comment
Question by:kenv611
1 Comment
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 37722382
that is fine . . . if you're looking for a % then just cast them as numbers:

select col1, col2, cast (col2 as number(18,2)) / cast (col1 as number(18,2)) * 100 as col3
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
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.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

759 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

22 Experts available now in Live!

Get 1:1 Help Now