简体   繁体   中英

Cannot resolve the collation conflict between “SQL_Latin1_General_CP1_CI_AS” and “Latin1_General_CI_AS” in the UNION operation

I have to join 2 views and create table which populates dates from the view.

But I am getting this error:

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the UNION operation.

CREATE VIEW [dbo].[Destinations_1415_1516_Union]
AS
SELECT *
FROM
[dbo].[Destinations_1415] 
UNION
SELECT *
FROM
[dbo].[Destinations_1516] 
GO

Please suggest how to resolve this

Hi agreeing with what people above have said, if you do the following:

SELECT ColumnA COLLATE DATABASE_DEFAULT
    ,ColumnB COLLATE DATABASE_DEFAULT
    --,... (rest of Columns)
FROM [dbo].[Destinations_1415] 
UNION 
SELECT ColumnA COLLATE DATABASE_DEFAULT
    ,ColumnB COLLATE DATABASE_DEFAULT
    --,... (rest of Columns)
FROM [dbo].[Destinations_1516]

This should get rid of your problem, you just need to identify what column it is that has the collation error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM