-1

我在查询中使用来自同一服务器的另一个数据库的数据

我收到给定的错误

无法解决等于操作中“SQL_Latin1_General_CP1_CI_AS”和“SQL_Latin1_General_CP850_BIN2”之间的排序规则冲突。本机错误:468。SQLSTATE:42000。严重性 16。MsgState 9。第 39 行。

我如何解决它?

with
 main AS (
SELECT a.LBrCode,a.PrdAcctId,b.SexCode,a.DateOpen,
case when (a.AcctStat=3 and a.DateClosed>'30-jun-2021') or a.AcctStat<>3 then 'live' else 'cl' end r1
FROM ac_mast a INNER JOIN prd_mat b ON a.CustNo=b.CustNo
WHERE rtrim(substring(a.PrdAcctId,1,8)) IN ('abc') AND a.AcctType=32

)
,
card_data AS (
SELECT substring(b.primary_a_c_number,1,3) LBrCode,
substring(b.primary_a_c_number,4,4)+replicate(' ',4)+replicate('0',8)+substring(b.primary_a_c_number,8,8)+replicate('0',8) PrdAcctId,
card_number,card_process_date,first_tran_date
FROM [hk_RDS2.0].dbo.cardx1 b

select a.LBrCode,a.PrdacctId,b.Card_number from main a inner join card_data b
on a.LBrCode=b.LBrCode and a.PrdAcctId=b.PrdAcctId

请帮忙

4

1 回答 1

0

只是为了把这个从董事会中删除......

将查询的最后一部分更改为:

select      a.LBrCode, 
            a.PrdacctId, 
            b.Card_number 
from        main      a 
inner join  card_data b on a.LBrCode = b.LBrCode collate database_default
                           and a.PrdAcctId = b.PrdAcctId
于 2021-09-05T19:08:16.153 回答