How Do You Collate in an Union All Statement

  • I've used collate in the past to join two tables together from different servers with different collation using a linked server, but now I need to bring together two sets of data with different collation by using UNION ALL. How

    SELECT InvNumber

    FROM [SERVERA].[DatabaseA].dbo.[TableA]

    UNION ALL

    SELECT OrderNumber

    FROM [SERVERB].[DatabaseB].dbo.[TableB]

    Database A is SQL_Latin1_General_CP1_CI_AS

    Database B is Latin1_General_Bin

    I have to come up with a solution that does not involve altering any databases.

    Thanks

  • Can you say

    SELECT OrderNumber COLLATE SQL_Latin1_General_CP1_CI_AS

    FROM [SERVERB].[DatabaseB].dbo.[TableB][/quote]

    in the second bit?

  • Yes I can say that.

    Thanks. That did the job.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply