Closed stracho closed 6 years ago
Sorry but your question seems unclear to me. I need to clarify them before knowing what you really want.
DECLARE @return_value int
EXEC @return_value = [dbo].[ReadProcessedP] @periodStart = N'now-1m', @periodEnd = now, @resampleInterval = 60, @parameters = ' ', @column1 = N'Ch_5'
SELECT 'Return Value' = @return_value
GO
Is this code put in the grafana panel? If yes then I don't know where the "now-1m" and "now" come from. They should be built-in template "$from" and "$to" in order to parse the time range.
The time parsed from "$from" and "$to" can be converted directly into `DATETIME` type.
2.
`ReadProcessedP 'now-1m', 'NOW', '60', '', 'CH_5'`
You execute this in SSMS right? And it returns `41,105899810791`?
So I assume your SP is selecting a value (maybe FLOAT type) and return another value (like `RETURN 1;` for example), right?
If that's the case, the first code will only return the `41,105899810791` value and not the 'Return Value' (this I am not sure, but it might be the case).
You shouldn't use FLOAT type in T-SQL and in Grafana also, because they cannot parse for some reasons. See https://github.com/gbrian/grafana-simple-sql-datasource/issues/23.
And one more point you should take a look at, that is the alias of returned columns. See https://github.com/gbrian/grafana-simple-sql-datasource/issues/21.
If your panel is single stat, make sure the only one row returned.
I can only go this far, good luck. 😄
Sorry, automatically closing old issues after several fixes. Please reopen if the problem persists.
I have a problem with SQL Query in Grafana. I have to query database with storred procedure.
SQL Query:
When I try to query in grafana query inspector shows:
But when I do this in MS SQL Managmenet Studio response is 41,105899810791 Can Grafana send "clear" query to MS SQL Database as Table or Graph ?