Colation Problem
May 17, 2006Hi,
I am using SQLServer 2000 with SP4 and I am getting a strange collation problem.
I have three tables, TEmployee, TMechanic and TManager, each with the two columns Firstname, Lastname which are both varchars.
I run the following query:
<PRE>
SELECT OUTERUNION.FIRSTNAME, OUTERUNION.LASTNAME FROM ((
SELECT QUERY1.FIRSTNAME, QUERY1.LASTNAME
FROM
TEmployee query1 WHERE FIRSTNAME = 'John'
UNION ALL
SELECT QUERY1.FIRSTNAME, QUERY1.LASTNAME
FROM
TCoManager query1 WHERE FIRSTNAME = 'John'
UNION ALL
SELECT QUERY1.FIRSTNAME, QUERY1.LASTNAME
FROM TMechanic query1 WHERE FIRSTNAME = 'John')
UNION
(SELECT QUERY2.FIRSTNAME, QUERY2.LASTNAME
FROM TEmployee query2 WHERE FIRSTNAME = 'Michael'
UNION ALL
SELECT QUERY2.FIRSTNAME, QUERY2.LASTNAME
FROM
TCoManager query2 WHERE FIRSTNAME = 'Michael'
UNION ALL
SELECT QUERY2.FIRSTNAME, QUERY2.LASTNAME FROM TMechanic query2 WHERE FIRSTNAME = 'Michael'
)) OUTERUNION
</PRE>
I get the following error:
Cannot resolve collation conflict for column 2 in SELECT statement.
If I change my select statement to only have one column (doesn't matter which column) it doesn't happen.
Any ideas, greatly appreciated?