free / sql_exporter

Database agnostic SQL exporter for Prometheus
MIT License
534 stars 171 forks source link

error when parsing MSSQL date time field #102

Open mirrorspock opened 3 years ago

mirrorspock commented 3 years ago

the query

      SELECT Activity, max(Stop) AS LastStopTime
      FROM [ACCP_API].[dbo].[ActivityLog]
      GROUP BY Activity

returns an error * [from Gatherer #1] [, collector="sixfold_data_freshness", query="sixfold_update_time"] scanning of query result failed: sql: Scan error on column index 1, name "LastStopTime": converting driver.Value type time.Time ("2021-09-13 12:33:03.543 +0000 UTC") to a float64: invalid syntax

the column type is datetime

roachleva commented 2 years ago

i am also facing the same..

scanning of query result failed: sql: Scan error on column index 0, name "time": converting driver.Value type time.Time to a float64: invalid syntax.

reubano commented 2 years ago

Same issue. Ended up casting to floats like this... CAST([Stop] AS FLOAT).