Estou recebendo este erro:
Erro ao converter o tipo de dados nvarchar para bigint
Quando tento executar a consulta abaixo, se eu remover a condição de comparação de datas, funciona perfeitamente.
select c.reference AccountNo,
i.insurance_cancellation_dt CustomerCancelDte,
cus.ext_name CustomerName,
case when f.amt_matched=0 then 'Paid' else 'Unpaid' end ChargebackStatus,
'' DlrCancelRequiredInd,
acf.reference NetcheckAccountNo,
iType.value ProductDesc,
acf.amount TotRefundAmt,
iParty.ext_name VendorName,
v.vin_no Vin
from
contract c
inner join
asset_hdr ah on c.contract_id = ah.current_contract_id
and c.dealer_id = 1201
and c.reference = '100981'
inner join
asset_hdr_insurance i on i.asset_hdr_id = ah.asset_hdr_id
-- and i.insurance_cancellation_dt > '2025-01-01'
-- and i.insurance_cancellation_dt < '2025-04-01'
inner join
party cus on cus.party_id = c.cparty_id
inner join
asset_custom_flow acf on acf.reference = i.asset_hdr_insurance_id
and acf.custom_flow_hdr_id = (select custom_flow_hdr_id
from custom_flow_hdr
where name = 'AMP Chargeback')
inner join
flow f on f.contract_id = c.contract_id
and f.custom_flow_link_no = acf.link_no
inner join
xt_lookupset iStatus on iStatus.xt_lookupset_id = i.insurance_status
inner join
xt_lookupset iType on iType.xt_lookupset_id = i.insurance_type
inner join
party iParty on iParty.party_id = i.insurance_party_id
inner join
asset_class_vehicle v on v.asset_hdr_id = ah.asset_hdr_id
and v.vin_no = 'TTXJG330ML5P34985'