0
Given this query:
SELECT
PontoSecullum4.DBO.funcionarios.N_FOLHA,
PontoSecullum4.DBO.funcionarios.NOME,
PontoSecullum4.DBO.funcionarios.EMPRESA_ID,
1 [ORIGEM]
FROM
PontoSecullum4.DBO.funcionarios
WHERE 1=1
AND NOT EXISTS(
SELECT CodigoFuncPonto
FROM WebAdiantamento.DBO.funcionario
WHERE FUNCIONARIO.CodigoEmpresa = 3
)
AND PontoSecullum4.DBO.funcionarios.n_folha = 11014
AND PontoSecullum4.DBO.funcionarios.empresa_id = 3
AND PontoSecullum4.DBO.funcionarios.demissao IS NULL
as you can see it does queries in different databases, I do not know if this is a sql server imitation, but by including this restriction I have no result
For example, the funcionario
Code 11014 does not exist in the working table of the database WebAdiantamento
, soon should come in this consultation, but in the brings nothing.
That way it didn’t work either:
SELECT
PontoSecullum4.DBO.funcionarios.N_FOLHA,
PontoSecullum4.DBO.funcionarios.NOME,
PontoSecullum4.DBO.funcionarios.EMPRESA_ID,
1 [ORIGEM]
FROM
PontoSecullum4.DBO.funcionarios
WHERE 1=1
AND PontoSecullum4.DBO.funcionarios.N_FOLHA NOT IN (
SELECT CodigoFuncPonto
FROM WebAdiantamento.DBO.funcionario
WHERE FUNCIONARIO.CodigoEmpresa = 3
)
AND PontoSecullum4.DBO.funcionarios.n_folha = 11014
AND PontoSecullum4.DBO.funcionarios.empresa_id = 3
AND PontoSecullum4.DBO.funcionarios.demissao IS NULL