June 15, 2005 at 9:06 am
What is wrong with this query?
SELECT C.COL_DAT AS CCOL, S.COL_DAT AS SCOL FROM CAL AS C, SCH AS S
WHERE S.SSN=123456789 AND S.REGION='N' AND
S.COL_DAT<='2005-06-04' AND S.COL_DAT >= '2005-05-22'
AND S.COL_DAT=C.COL_DAT
I get the following error:
Server: Msg 446, Level 16, State 9, Line 1
Cannot resolve collation conflict for equal to operation.
If I remove the last line of the query it runs. (Not the correct results, but it runs) COL_DAT in both tables is a char(10). Both tables only have dates in the format YYYY-MM-DD in the COL_DAT column.
??????
June 15, 2005 at 9:39 am
Check the collations on each of them. You will have to either change the collation of one of the columns or cast the collation of one of them in the compare.
The syntax is simple, if you decided to cast the C.Col_Dat column you would just do the following:
AND S.COL_DAT=C.COL_DAT COLLATE <Collation Name>
See the article titled "Collation Precedence" in BOL for more details.
/*****************
If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek
*****************/
June 15, 2005 at 10:02 am
The collations didn't match up. I didn't realize that you could chose collation at the column level. Thanks.
June 15, 2005 at 10:06 am
The collations didn't match up. I didn't realize that you could chose collation at the column level. Thanks.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply