November 21, 2001 at 12:42 pm
Can't I write a select statement that pulls data from two different tables even if the tables reside on two different dB's that are on the same server?
I'm using SQL2K without the service pack. I get the following error when I try:
Server: Msg 446, Level 16, State 9, Line 1
Cannot resolve collation conflict for equal to operation. Here is the T-SQL:
SELECT b.LastName, b.FirstName, a.ExpenseNo, a.EmployeeNo
FROM devExpense.dbo.ExpenseHeader AS a INNER JOIN devCorp.dbo.OrganizationEmployee AS b
ON a.EmployeeNo = b.EmployeeNo
where a.ExpenseNo = '1913-22-099-76441'
November 21, 2001 at 2:50 pm
Sounds like the two databases are defined with different collations and the server can't decide what equals means between them.
Cursors never.
DTS - only when needed and never to control.
November 21, 2001 at 3:27 pm
You can probably do it with an exlicit collation convertion - something like
SELECT b.LastName, b.FirstName, a.ExpenseNo, a.EmployeeNo
FROM devExpense.dbo.ExpenseHeader AS a INNER JOIN devCorp.dbo.OrganizationEmployee AS b
ON a.EmployeeNo collate Latin1_General_BIN = b.EmployeeNo collate Latin1_General_BIN
Cursors never.
DTS - only when needed and never to control.
November 21, 2001 at 5:45 pm
Thank you nigelrivet. It works fantastic!! Many, many thanks and have a wonderful holiday...
September 10, 2004 at 10:12 am
Man... U save my work ! Thankz !!!
September 10, 2004 at 10:39 am
Since you got a collation error with the equals part of the JOIN, I'm wondering if SQL Server is thinking that was a date.
For example: If I want to check for a specific date/time I would do this:
WHERE mydatetime = '2004-09-10 12:00:00'
So it might be possible that SQL Server is thinking that you are looking for a date and time in the year 1913, but your format doesn't match any collation.
-SQLBill
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply