return 2 digits from sql statement with a divide in it

Sql statment:
select Sum((ialrtartot-ialrtvptot)/(ialrtartot)) as Yield from table.

I only want 2 digits returned for yield, i.e. .26.

Thanks
LVL 2
bergertimeAsked:
Who is Participating?
 
cmhuntyCommented:
Does this work?

select CAST(Sum((ialrtartot-ialrtvptot)/(ialrtartot)) AS decimal(10,2)) as Yield from table
0
 
SQL_SERVER_DBACommented:
select ROUND(Sum((ialrtartot-ialrtvptot)/(ialrtartot)),2) as Yield from table
0
 
bergertimeAuthor Commented:
cmhunty, it works but rounds down, sql server dba it rounds up but does not cut off the digits, as I get .29000000.  Since it does not have to be rounded up it will work for me,  thanks to both of you.
0
 
cmhuntyCommented:
Guess you could do both!

select CAST(ROUND(Sum((ialrtartot-ialrtvptot)/(ialrtartot)),2) AS decimal(10,2)) as Yield from table
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.