1 2
|
SELECT TUT_NO_CLIENT AS NUMCL, TUT_NO_EVT, TUT_CHRONO, TUT_COMMENTAIRE, TUT_TYPE_TACHE AS TYPET,CONVERT(char(10),TUT_DATE,23) AS STARTDATE, CONVERT(char(10),TUT_DATE_ECHEANCE,23) AS ENDDATE, LEFT(CONVERT(VARCHAR(5), TUT_HHMMSS, 8), 4) AS STARTTIME, LEFT(CONVERT(VARCHAR(5), TUT_HEURE_ECHEANCE, 8), 4) AS ENDTIME, TUT_UTILISATEUR_ORIGINE AS EXPED, TUT_UTILISATEUR_DESTINATION AS DESTINATAIRE FROM V_TCU_ha3 WHERE (DATEDIFF(day, CURRENT_DATE, TUT_DATE_ECHEANCE) > 0) OR ((DATEDIFF(day, CURRENT_DATE, TUT_DATE_ECHEANCE) = 0) AND (CONVERT(int, SUBSTR(TUT_HEURE_ECHEANCE, 1, 2), 2) > CONVERT(int, SUBSTR(CONVERT(char, { fn CURTIME() }, 8), 1, 2), 2))) OR (DATEDIFF(day, CURRENT_DATE, TUT_DATE_ECHEANCE) = 0) AND (CONVERT(int, SUBSTR(TUT_HEURE_ECHEANCE, 1, 2), 2) = CONVERT(int, SUBSTR(CONVERT(char, { fn CURTIME() }, 8), 1, 2), 2)) AND (CONVERT(int, SUBSTR(TUT_HEURE_ECHEANCE, 3, 2), 2) >= CONVERT(int, SUBSTR(CONVERT(char, { fn CURTIME() }, 8), 4, 2), 2)) |
Partager