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.
| Author |
Topic |
|
stumbling
Posting Yak Master
104 Posts |
Posted - 2007-05-01 : 20:52:59
|
| Hi All :-)I am stuck on what is probably a very basic issue but the answer is lost to me, and hope someone out there can guide me in the correct direction.I have a problem with the following i get the message Server: Msg 174, Level 15, State 1, Line 1The sum function requires 1 arguments.I need to sum two fields that are decimal (9,2) but it has to return the sum as decimal (9,2) ie (555.66) i then have to remove the decimal place and then i have to convert to varchar and add leading zeros whew my brain hurts LOL.select right(replicate('0', 25) + (replace (convert (varchar (25) ,sum(convert(decimal (9,2), (Qtysold) * isnull(Unitprice,0)),'.','')from #DataExport_tmphope some of this make sence to someone out there.CheersPhil |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-05-01 : 21:10:01
|
| You have 11 left parentheses, '(', and 7 right parentheses, ')', in your query.CODO ERGO SUM |
 |
|
|
stumbling
Posting Yak Master
104 Posts |
Posted - 2007-05-01 : 21:13:54
|
| thanks i have serious brain drain i think i managed to fix it i believe using the followingselect right(replicate ('0',25) + convert(varchar (25),convert(decimal (9,2), sum((Qtysold) * isnull(Unitprice,0)))),25) from #DataExport_tmpCheersPhil |
 |
|
|
|
|
|
|
|