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
 General SQL Server Forums
 New to SQL Server Programming
 Rounding

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2009-02-18 : 15:05:27
I have the following code:

SET tot_sls_amt = (select(A.SumExtUnitPrice*100)/100 from(selecT ord_type,Ord_no,sum((UNIT_PRICE*QTY_ordered)-((unit_price * qty_ordered)*(DISCOUNT_PCT*.01)))
as SumExtUnitPrice from oeordlin_sql


I need to round this portion of it before it gets summed:
(UNIT_PRICE*QTY_ordered)-((unit_price * qty_ordered)*(DISCOUNT_PCT*.01))


I've tried the following but get the message:
Msg 189, Level 15, State 1, Line 453
The round function requires 2 to 3 arguments.


SET tot_sls_amt = (select(A.SumExtUnitPrice*100)/100 from(selecT ord_type,Ord_no,sum(Round(UNIT_PRICE*QTY_ordered)-((unit_price * qty_ordered)*(DISCOUNT_PCT*.01))),2)as SumExtUnitPrice from oeordlin_sql




jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-02-18 : 15:13:55
It's the ) that you're missing

SUM(ROUND((UNIT_PRICE*QTY_ordered)-((unit_price * qty_ordered)*(DISCOUNT_PCT*.01)),2))

Jim
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-02-18 : 15:19:37
[code]
select @tot_sls_amt =(A.SumExtUnitPrice*100)/100
from
( selecT ord_type,Ord_no,
sum(ROUND(
(UNIT_PRICE*QTY_ordered)-(
(unit_price * qty_ordered)*(DISCOUNT_PCT*.01)
)
,2)
)as SumExtUnitPrice
from
oeordlin_sql
)S[/code]
Go to Top of Page

Vack
Aged Yak Warrior

530 Posts

Posted - 2009-02-18 : 15:51:47
that was it, thanks a lot.
Go to Top of Page
   

- Advertisement -