In SQL Server it only accepts 4 prefixes in sentences, eg Select * from pmv.banco.dbo.tabela
. In this case, I'm using a client linked server.
However, when I refer to some table field, where I would get a prefix ( pmv.banco.dbo.tabela.campo
), I can not continue because SQL does not accept it. Would you know a possible solution to 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