Solved

sum of varchar column

Posted on 2010-11-19
2
692 Views
Last Modified: 2012-05-10
select SUM(paymentfee) from payments where  
(
(type='Paypal' and 'confirmation'!='' and resultcode!='Denied' and resultcode!='unconfirmed')
or
(type!='Paypal')
)


Msg 8117, Level 16, State 1, Line 1
Operand data type varchar is invalid for sum operator.
0
Comment
Question by:rgb192
2 Comments
 
LVL 9

Accepted Solution

by:
JonMny earned 500 total points
ID: 34175823
select Sum(Cast(paymentfee As Decimal(10,2)))
0
 

Author Closing Comment

by:rgb192
ID: 34175850
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

685 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