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 |
|
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2010-05-12 : 08:17:54
|
| Once again I turn to you SQL Guru's for query assistance.Here is my issue....I am trying to sum the records returned from the below query based on its symbol. The problem is, symbol is not an int. Symbol has a nchar(3) data type.When I try, I get the following error: "Operand data type nchar is invalid for sum operator."Can someone help me out with this? I take it a cast or convert is needed (which I tried with no luck)? In case you are wonderig, sample SYMBOL values could be "XXX", "123", "12A", etc..[code] SELECT sum(SYMBOL) as SYM, TRANS_TS as TRAN_DATE, 'A' as ACTIVE_SER FROM TEST_TABLE WHERE PRO_IND = 'Y' and TRAN_TYPE = 'U' GROUP BY TRAN_DATE[code/] |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-05-12 : 08:20:53
|
quote: sample SYMBOL values could be "XXX", "123", "12A"
So how do you want to "SUM" these symbol ? What is the expected result ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
mrm23
Posting Yak Master
198 Posts |
Posted - 2010-05-12 : 08:27:22
|
| r you trying to Count the number of records instead? |
 |
|
|
qman
Constraint Violating Yak Guru
442 Posts |
Posted - 2010-05-12 : 10:09:01
|
| Using count worked, thanks.... |
 |
|
|
|
|
|
|
|