..... $sql = "select CAST(CAST(hs_date AS DATE format 'YYYYMMDD') AS CHAR(08)) as hs_date, " . "device, " . "thrshld as CPU_threshold, " . ...