SQLSTATE[HY000]: General error: 20003 Adaptive Server connection timed out [20003] (severity 6) [(null)] (SQL: /* ********************************************************************************************************** * AUTOR: INACIO MARQUES DA SILVA - LG/MG: inacio.silva@lg.com.br ********************************************************************************************************** * OBJETIVO: Atender Portal da Transparencia, item '6.3.2.1. Quadro de Servidores - ATIVOS' ********************************************************************************************************** REGRAS: * FUNCIONARIOS DA EMPRESA 1 * APENAS FUNCIONARIOS DE NATUREZA PROFISSIONAL = 1. MEMBROS ---------------------------------------------------------------------------------------------------------- */ -- declare @data_ref int -- set @data_ref = 20170901 SELECT FU.FUMATFUNC AS Matricula ,FU.FUNOMFUNC AS Nome ,CAR.CADESCARGO AS DescCargo ,(select CAR.CADESCARGO FROM CARGOS CAR WHERE CAR.CACODEMP=FU.FUCODEMP AND CAR.CATIPOSAL = 7 AND CAR.CACODCARGO = ISNULL((SELECT top 1 OL.OFCODCGANT FROM OCORFUNC OL WHERE OL.OFCODEMP = 1 AND OL.OFCODOCORR = 1012 AND OL.OFMATFUNC = FU.FUMATFUNC AND OL.OFDTINIOCO > :dateInitial AND NOT EXISTS (SELECT 1 FROM OCORFUNC OL1 WHERE OL1.OFMATFUNC = FU.FUMATFUNC AND OL1.OFCODEMP = 1 AND OL1.OFCODOCORR = 1003 AND OL1.OFDTINIOCO > :dateInitial AND OL1.OFDTINIOCO < OL.OFDTINIOCO)) , FU.FUCARGOCOM)) AS DescFuncao ,(select CASE WHEN ISNULL(LOOBS,'') <> '' THEN LOOBS ELSE LODESCLOT END FROM LOTACOES WHERE LOCODEMP= FU.FUCODEMP AND LOCODLOT= ISNULL(--(SELECT TOP 1 OL.OFCODLTANT FROM OCORFUNC OL WHERE OL.OFCODEMP = 1 AND OL.OFCODOCORR = 1003 AND OL.OFMATFUNC = FU.FUMATFUNC AND OL.OFDTINIOCO > :dateInitial ORDER BY OL.OFDTINIOCO) (SELECT top 1 OL.OFCODLTANT FROM OCORFUNC OL WHERE OL.OFMATFUNC = FU.FUMATFUNC AND OL.OFCODEMP = 1 AND OL.OFCODOCORR = 1003 AND OL.OFDTINIOCO > :dateInitial AND NOT EXISTS (SELECT 1 FROM OCORFUNC OL1 WHERE OL1.OFMATFUNC = FU.FUMATFUNC AND OL1.OFCODEMP = 1 AND OL1.OFCODOCORR = 1003 AND OL1.OFDTINIOCO > :dateInitial AND OL1.OFDTINIOCO < OL.OFDTINIOCO)) , FU.FUCODLOT) ) AS DescLotacao ,' ' AS AtoPort ,CONVERT(VARCHAR,CONVERT(DATETIME,CONVERT(VARCHAR, PF.DP_DATA_PUBLICACAO)),103) AS DataPubl ,CONVERT(VARCHAR,CONVERT(DATETIME,CONVERT(VARCHAR, FU.FUDTADMIS)),103) ADMIS ,CONVERT(VARCHAR,CONVERT(DATETIME,CONVERT(VARCHAR, OC.OFDTINIOCO)),103) RESC FROM FUNCIONA FU LEFT JOIN OCORFUNC OC ON OC.OFCODEMP = 1 AND OC.OFCODOCORR = 1004 AND OC.OFMATFUNC = FU.FUMATFUNC LEFT JOIN MP_DP_FUNCIONA PF ON FU.FUCODEMP = PF.FUCODEMP AND FU.FUMATFUNC = PF.FUMATFUNC INNER JOIN EMPRESAS ON EMCODEMP=FU.FUCODEMP LEFT JOIN SITUACAO ON STCODEMP=FU.FUCODEMP AND STCODSITU=OC.OFCODPROXS INNER JOIN MP_PARAM_TIPO_FUNCIONARIO ON MPTF_CODIGO_EMPRESA_GENERICA=FU.FUCODEMP AND MPTF_CODIGO_NATUREZA_PROFISSIONAL=FU.FUCNATPROF INNER JOIN CARGOS CAR ON CAR.CACODEMP=FU.FUCODEMP AND CAR.CATIPOSAL=FUTIPOSAL AND CAR.CACODCARGO=FU.FUCODCARGO --LEFT OUTER JOIN CARGOS FUN ON FUN.CACODEMP=FU.FUCODEMP AND FUN.CATIPOSAL=FU.FUCCMTPSAL AND FUN.CACODCARGO=FU.FUCARGOCOM LEFT OUTER JOIN ATRIBFUN AF0002 ON AF0002.AFCODEMP=FU.FUCODEMP AND AF0002.AFMATFUNC=FU.FUMATFUNC AND AF0002.AFCODATRIB=2 --LEFT OUTER JOIN MP_DP_FUNCIONA MPFUN ON MPFUN.FUCODEMP=FU.FUCODEMP AND MPFUN.FUMATFUNC=FU.FUMATFUNC --AND MPFUN.DP_ID=(SELECT MIN(DP_ID) FROM MP_DP_FUNCIONA MPFUNMIN WHERE MPFUNMIN.FUCODEMP=FU.FUCODEMP AND MPFUNMIN.FUMATFUNC=FU.FUMATFUNC) WHERE FU.FUCODEMP = 1 AND FU.FUCNATPROF in (3 /*SERVIDORES*/, 9 /*RA*/) AND FU.FUDTADMIS < :dateInitial AND (OC.OFDTINIOCO > :dateInitial OR OC.OFDTINIOCO IS NULL) -- and FU.FUMATFUNC IN (124500, 227300, 557300) ORDER BY FU.FUNOMFUNC )