Grafana graph data source microsoft sql server

Hallo, im new user on grafana, i try to make a time series dashboard in grafana and i follow the tutorial in this link.

I try this query: ```
measurement as metric

but still no data points, but no error with the query, i need help, please correct me if my query is wrong. Thanks

Have you seen this recent thread?

Hi, thanks for repply!

Yes, i already read that thread but i think is it not solved yet.


Well to save me asking all the same questions again, start by answering all the questions from that thread.

Thanks for your support, i already read and try your suggestion. Before that i think this is because 2018, so the value cannot be displayed, but i changed with 2019, and change “today” in grafana. but still no data point. do you have any suggestion? thanks !


Show us what the raw query shows, from an application other than grafana, and show us a screenshot showing the query and the graph.

Hi, i think this is already solved yet. but still use manual querys like “INSERT INTO [Dev].[dbo].[metric_values] (time, measurement, valueOne, valueTwo) VALUES (‘2019-04-09 14:03:00’, ‘Metric A’, 62, 6)”.

How can i change the date to automatic time? i try to used “current_timestamp” but this is did not worked.

I create table like this:
Metric_values .


Not sure what you are asking. Are you asking how to get data into the database?

Hello, i already realize, this is only the time range issue. i change the value to CURRENT_TIMESTAMP, The graph is show when we set time range become today, but, i checked again, the time stored into the grafana is not same as time server. can you help me with this issue ?

  1. Give an example time it shows for a sample and what you think it should show.
  2. If, in Grafana, you set the time range to something like Last 12 Hours does it show the current time at the right hand end of the scale (not the data points but the scale itself). If not then what does it show and what should it show?
  3. What is the time zone of the computer running the browser set to?
  4. What is the time zone of the computer running the Grafana server set to?
  5. What is the time zone of the computer running MSSQL set to?
  6. What is your actual time zone?

Hello thanks for your repply,

  1. for example, i change the time zone to utc, The value shows with the right time,but current times in grafana if i used utc is not correct. like this pict

    like in the picture, if i change to last 5 minutes, the grafana will shows value with the current time in grafana, but the time is not match with my pc server.
  2. And i also realized the weird things, if i set last 12 hours, the values is gone, even though the values i input in mssql is not less than 12 hours in grafana time.
  3. The time zone of the computer is UTC+07:00
  4. Time zone in grafana set as UTC, maybe following international UTC(12:00)
  5. Time zone in mssql follow the server, it is UTC+07:100:
  6. My actual time zone is UTC:07:00


please focus on the top graph, because the others is using random walk from grafana, thanks

On the first graph you have said the value shows the right time. Do you mean it is showing the right UTC time? If so then what is wrong with the first graph? The time axis looks correct as you have asked for today UTC.

Do you actually want to use UTC in grafana? If not then why confuse things by using that to answer the questions? Unless you want to use UTC in grafana it might be better to go back and answer the questions again with grafana set to local time.

On point two you say the data point doesn’t appear if you show last 12 hours, but since you have not told me at what time you expect it to appear that doesn’t help much. If you extend the time range where does the data appear?

Correct, i said the values show the right time (mssql and pc time), but if change to last 5 minutes, is it does not appear, because i used UTC in time zone. why i used UTC? because i tried all of the timezone,

first, i try default, the problem is the value cannot get the right time, for example the timestamp is 14:00:00, but it will show in grafana in 17:00:00.

second, i try with local browser, the value stored in grafana is in 17:00:00, but the grafana time(in real time) is 14:00:00.

and the last i used UTC, Is almost same like default, but the different is the value appear in the right time, for example the timestamp is in 14:00:00, but the grafana will following UTC time(in real UTC+12), thats why when i change it to last 5 minutes, the value do not appear.

I think if i used last 12 hour, the value will appear, for example the grafana time is 19:00, and the value time is 14:00, so if the values can show if i choose today, why the values does not appear if i set to last 12 hour?


Sorry, you have completely lost me with all this messing about with time zones. If you like you can start again, stick to local time everywhere, show us what you see and explain what you expect to see.

The point is i want to see the time value(in grafana), and in my pc is the same time. i very confused with this issue, because the value i write in mssql is not same as the valu which appear in grafana. I try the same way with influxdb, and it works.


I assumed that is what you want, but you have not posted a simple example showing what you get and what you expected to get.

@malikiy make sure to store dates in UTC in your table or use epoch (seconds since 1970) which is UTC.

I think that probably is the problem (timestamps in the db not in UTC), but can’t be certain till we see exactly what the symptom is.

ok i will use a simple example.

This is query i write to store in mssql:
INSERT INTO [Dev].[dbo].[metric_values] (time, measurement, valueOne, valueTwo) VALUES (CURRENT_TIMESTAMP, ‘Metric A’, 62, 6)
INSERT INTO [Dev].[dbo].[metric_values] (time, measurement, valueOne, valueTwo) VALUES (CURRENT_TIMESTAMP, ‘Metric B’, 49, 11)
INSERT INTO [Dev].[dbo].[metric_values] (time, measurement, valueOne, valueTwo) VALUES (CURRENT_TIMESTAMP, ‘Metric A’, 14, 25)
INSERT INTO [Dev].[dbo].[metric_values] (time, measurement, valueOne, valueTwo) VALUES (CURRENT_TIMESTAMP, ‘Metric B’, 48, 10)


and i want to show it in grafana, like in the picture, time is using CURRENT_TIMESTAMP, it will appear a value of current time in server.

But, there is an issue with time zone setting in grafana, if i used default, the (time) in database is not same with the(time) in grafana.

If timezone use default: value appear in database is more faster than real time in server, i give an attachment to proof time is more faster than real time in mssql and pc)


if timezone use local time browser: This timezone have a same issue.


If timezone use UTC: The value appear in database already have a same time with Real time in mssql and pc), but if i use utc, i know real time in grafana will follow UTC+12:00, so if i used last 5 minutes, it will not appear, because real time in grafana is following UTC+12:00(UTC international), so this is not fix my issue.

my expect is the data can be appear in the same time with grafana,mssql, and pc. I already change time setting in my pc to UTC+12:00, but the data but delay 12 hours. i will give an attachment to proof.
capture 5 & 6: time setting(pc) use UTC+7:100:
capture 7,8,9,10: time setting (pc) use UTC+12:00:


Capture 9 & 10: The value appear in grafana already same like pc & mssql time, but real time in grafana becom delayed 12 hours.