sql_exporter icon indicating copy to clipboard operation
sql_exporter copied to clipboard

error when parsing MSSQL date time field

Open mirrorspock opened this issue 3 years ago • 2 comments

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

mirrorspock avatar Sep 13 '21 10:09 mirrorspock

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.

roachleva avatar Nov 03 '21 16:11 roachleva

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

reubano avatar May 16 '22 01:05 reubano