Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the Round Function 1

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
hi all,

I'm doing a computation as I write the record.

The following passes the syntax check, but I don't know if it will compute correctly:

Round(CalculatedAmount * .6666667 * -.25,2) AS [Trans Amt]


If I try Round(CalculatedAmount * .6666667) * (-.25,2) AS [Trans Amt] I get a syntax error saying "The ROUND function requires 2 or 3 arguments.

Thanks for any help. John
 
From Books On Line:
ROUND ( numeric_expression , length [ , function ] )

Arguments
numeric_expression

Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type.

length

Is the precision to which numeric_expression is to be rounded. length must be tinyint, smallint, or int. When length is a positive number, numeric_expression is rounded to the number of decimal places specified by length. When length is a negative number, numeric_expression is rounded on the left side of the decimal point, as specified by length.

function

Is the type of operation to perform. function must be tinyint, smallint, or int. When function is omitted or has a value of 0 (default), numeric_expression is rounded. When a value other than 0 is specified, numeric_expression is truncated.
 
Thanks jbenson001.

I understand, but it is the 2 multiplys that seem to be causing the problem.

It needs to do (CalculatedAmount * .6666667) first, then multiply that result x -.25

Sorry for being thick, but I don't know how to code thr ROUND stmt and enable it to do the first multiplication, then the second one.

Thanks. John
 
Do you want the ROUND of the entire calculation?
Round(CalculatedAmount * .6666667 * -.25,2 ,length)
 
I got it:

ROUND(CalculatedAmount * .6666667,2) * -.25 AS [Trans Amt]

Thanks jbenson001.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top