Link to home
Start Free TrialLog in
Avatar of Noreen McHugh
Noreen McHughFlag for Ireland

asked on

Collation error when importing

HI

I am trying to import data from a sql 2005 server instance to a table on sql 2008 via a linked server. The code is attached.
I am getting a collation error, see below. However I have imported other data from a view on the 2005 sql to the 2008 sql with no problems. I am unsure what I need to do to resolve this.

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the EXCEPT operation.
INSERT INTO [PJ Combined Sales].[dbo].[AndroRefunds]
           ([FiscalDate]
           ,[RestaurantCode]
           ,[Type]
           ,[Amount]
           ,[Description])
     
 SELECT 
       [TheDate] 
,[nStoreID]
      ,[nType]
      
      ,sum([nAmount])/100.00 as Refunds
      ,[strDetails]
      
  FROM [WORKSPJ1].[HeadOffice].[dbo].[t_CashRec]
  WHERE ([strDetails] LIKE  '%ref%') AND ([nType] = '1')
  AND NOT EXISTS 
  (SELECT x.[FiscalDate], x.[RestaurantCode]
FROM [PJ Combined Sales].[dbo].[AndroRefunds] as x
WHERE x.[Fiscaldate]= [TheDate] 
and x.[RestaurantCode] = [nStoreID])

GROUP BY [TheDate],[nStoreID],[nType],[strDetails]

EXCEPT
SELECT [FiscalDate],
[RestaurantCode],
 [Type],
 [Amount],
 [Description]

FROM [PJ Combined Sales].[dbo].[AndroRefunds]

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of JohnP_Realini
JohnP_Realini
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Noreen McHugh

ASKER

Thanks, I put it in after the final SELECT statement and that worked.  
Great! Glad I could help...

have a great day