Friday, March 30, 2012

Query, what's wrong here?

Hi
I get an error when I try to limit the "digits" I want to summerize, I have
only added the line
"and digits in (select digits from series)"
when it there the it fails and gives the errpr Msg 446, Level 16, State 9,
Line 8
The only thing I can imagine is that it's because I'm "joining" with another
table. the datatypes are identical.
declare @.site int
declare @.calltype char(1)
set @.site = 1
set @.calltype = 'E'
SELECT digits, COUNT(*) AS total, /* Line 9 */
COUNT(CASE WHEN durationofconversation > 0 THEN 1 END) AS besvaret,
COUNT(CASE WHEN durationofconversation = 0 AND releasecause = 'OC'
THEN 1 END) AS optaget,
COUNT(CASE WHEN durationofconversation = 0 AND releasecause = 'RL'
AND durationofcall < 40 THEN 1 END) AS opgivet,
COUNT(CASE WHEN durationofconversation = 0 AND durationofcall >= 40
THEN 1 END) AS ubesvaret
FROM V2tickets WHERE
siteid = @.site AND calltype = @.calltype AND LEN(digits) = 4
/* adding this statement gives the errpr Msg 446, Level 16, State 9, Line 8
*/
and digits in (select digits from series)
GROUP BY digits
ORDER BY digits
regards
HenryThe error is due to a collation conflict. It looks like the Digits
column in Series must have a different collation to the Digits column
in V2tickets. Either change one of the collations or specify an
explicit collation in the query.
See Books Online for more information on collations.
David Portas
SQL Server MVP
--|||"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> skrev i en
meddelelse news:1108503649.678190.90910@.z14g2000cwz.googlegroups.com...
> The error is due to a collation conflict. It looks like the Digits
> column in Series must have a different collation to the Digits column
> in V2tickets. Either change one of the collations or specify an
> explicit collation in the query.
> See Books Online for more information on collations.
Been there, done that, fixed the problem, a lot of stuff to keep track off
here.
Thanks for pointing me the right direction.
regards
Henry

No comments:

Post a Comment