3
In SQL Server it accepts only 4 prefixes in the sentences, e.g.: Select * from pmv.banco.dbo.tabela
. In this case, I am using a client Linked server.
However, when I reference some field of the table, where would be 5 prefix (pmv.banco.dbo.tabela.campo
), I can’t continue because SQL doesn’t accept it. Would you know a possible solution for this ? Could you give me tips ?
UPDATE LINK.base.dbo.Tabela
SET cliq.situacao = 'C'
FROM LINK.base.dbo.Tabela cliq
JOIN #tmpTabela tmp ON tmp.idreferencia = cliq.idreferencia
JOIN BRMLiquidacoes anu ON anu.idbrmliquidacao = tmp.IdReferencia
JOIN BRMLiquidacoes mov ON mov.tipomov = 1
AND mov.unges = anu.unges
AND mov.brmano = anu.brmano
AND mov.brmnum = anu.brmnum
AND mov.anoint = anu.anoint
AND mov.numint = anu.numint
AND mov.empenho = anu.empenho
AND mov.anoemp = anu.anoemp
AND mov.valor = ABS(anu.valor)
JOIN LINK.base.dbo.Tabela cp ON cp.IdReferencia = mov.idbrmliquidacao
AND cp.lancto_liquidacao_cp = 'N'
AND cp.situacao = 'A'
AND cp.IdReferencia = (
SELECT MIN(smov.idbrmliquidacao) FROM BRMLiquidacoes smov
JOIN LINK.base.dbo.Tabela cp ON cp.IdReferencia = smov.idbrmliquidacao
AND cp.lancto_liquidacao_cp = 'N'
AND cp.situacao = 'A'
WHERE smov.tipomov = 1 AND smov.unges = anu.unges AND smov.brmano = anu.brmano AND smov.brmnum = anu.brmnum AND smov.anoint = anu.anoint AND smov.numint = anu.numint AND smov.empenho = anu.empenho AND smov.anoemp = anu.anoemp
AND smov.valor = ABS(anu.valor)
)
WHERE tmp.excluir = 1 AND tmp.data_inclusao_brm IS NOT NULL
I updated my reply as per your update
– Maicon Carraro