IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO]') AND type in (N'U'))
BEGIN
-- INSERT DAS FORMAS DE PAGAMENTO CC
INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'CC', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%CREDITO%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)

INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'CC', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%PARCELA%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)


-- INSERT DAS FORMAS DE PAGAMENTO CD
INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'CD', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%DEBITO%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)

INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'CD', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%ELETRON%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)

INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'CD', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%MAESTRO%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)

-- INSERT DAS FORMAS DE PAGAMENTO PIX
INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'PI', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%PIX%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)

-- INSERT DAS FORMAS DE PAGAMENTO RAPPI
INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'CA', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%RAPPI%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)

-- INSERT DAS FORMAS DE PAGAMENTO QRLINX SALDO
INSERT INTO RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO
SELECT 'CA', CD_ADM_CARTAO
  FROM RC_ADM_CARTAO
 WHERE RC_ADM_CARTAO.NM_USUAL LIKE ('%SALDO%') AND CD_ADM_CARTAO NOT IN (SELECT CD_ADM_CARTAO FROM RC_ADM_CARTAO_EQUALSCORE_FORMA_PAGAMENTO)

 END