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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sum of field with a varchar datatype

Author  Topic 

genic
Yak Posting Veteran

57 Posts

Posted - 2001-02-20 : 12:14:31
i am trying to get the sum of a field that has a varchar datatype. reason it has a varchar datatype is due to some records having a decimal point (ie. 4.5 or .6 or 6) ..i keep getting the error of

The sum or average aggregate operation cannot take a char data type as an argument

i can not convert to smallint ..what other datatype is suggested or difference in my sql statement is suggested?

the statement
-------------
select sum(b.hours) as totalAnalysis from profile as a inner join projecttime as b on (b.profileemail = a.profileemail) where b.activity = 'Analysis'
   

- Advertisement -