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 |
|
obiwaugh
Starting Member
27 Posts |
Posted - 2004-12-13 : 10:12:24
|
| I want to evaluate a field in the following way...SUM ( CASE PS_JOB.ACTION WHEN 'TER' THEN '1' ELSE '0' END )I get an error saying that the varchar datatype is invalid. I think it's because I'm examining a varchar field, and trying to return a number value. Can I say something like THEN INT(1)? |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-12-13 : 10:19:11
|
| SUM (CASE PS_JOB.ACTION WHEN 'TER' THEN 1 ELSE 0 END )The CASE expression can compare any data types, but it does not have to return the same data type. |
 |
|
|
|
|
|