SQL query with variable (26 characters long)

  • What Grafana version and what operating system are you using?
    8.0.1

  • What are you trying to achieve? I am using a SQL datasource with some variables. I defined a variable with a text and id value. The ID value is a numeric field with 26 characters.

When I use it in a query though, it does not show the actual value but something like 5.221325173822737e**+25**. This causes that my queries don’t work or mostly don’t work. How can I have Grafana show the actual value instead of a sum.

  • What did you expect to happen? Show the actual value instead of “+25”

Thanks in advance!

1 Like

Overrides?

Have the same issue even with 8 digit HEX values for serial numbers in my data

01005E26 = 1005 e + 26 ( Grafana defaults )

See here with one of my fields or you can do a whole column etc

image

Doesn’t seem to work. Overrides aren’t for variables as well though. See below:

I found a solution. I converted my value to varchar via my SQL query. It now shows it correctly.

convert(varchar(55), id) as __value

Thanks for the help!

1 Like

I had the same item happen with a datetime in mysql… I had to use cast as it showed up as a int

SELECT cast(last_seen_at as char) FROM user WHERE login=’${__user.login}’

if I did just last_seen_at it was a really ugly number that I had lots of digits…