Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Union 1

Status
Not open for further replies.

LDL30

IS-IT--Management
Mar 31, 2003
14
DE
Hello,

I have two databases (db1 and db2). In them I have two same tables and I need to make union of them so that I pickup all data.

Both select are the same :

select
db1.dbo.tblUsers.userid,
db1.dbo.tblUsers.name,
db1.dbo.tblUsers.datum
from db1.dbo.tblUsers

union

select
db2.dbo.tblUsers.userid,
db2.dbo.tblUsers.name,
db2.dbo.tblUsers.datum
from db2.dbo.tblUsers

but I am getting : Cannot resolve collation conflict for UNION operation.

When I run each select separetly it works ok.
Any ideas ?

Thanks,
Oliver
 
I forgot, both databases have same collation : Latin1_General_CI_AS and fields are with same type.
 
There is no way it cant work.
I tried out like this for u

Select * from db01..test
union
select * from db02..test.

It worked as perfect as anything.
Wonder what problem was urs and where.
 
Add an explicit collate clause for the char column

select
db1.dbo.tblUsers.userid,
db1.dbo.tblUsers.name collate Latin1_General_CI_AS ,
db1.dbo.tblUsers.datum
from db1.dbo.tblUsers

union

select
db2.dbo.tblUsers.userid,
db2.dbo.tblUsers.name collate Latin1_General_CI_AS ,
db2.dbo.tblUsers.datum
from db2.dbo.tblUsers
 
Thanks :)
collate Latin1_General_CI_AS solved problem

Oliver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top