SQL server Stored procedure help

I am testing the new SQL server data source plugin for Grafana and I’m stuck on trying to get the stored procedure to work.

I want to use the SPROC “execute SPROC 50, '01/30/2018 12:00:00 AM', '05/31/2018 2:30:00 AM'

50 is the server ID.

The sproc:

CREATE Procedure [dbo].[Sproc]    
( @ServerIDParam smallint, @StartDate datetime, @EndDate datetime)
As
Begin
    select
		diagLog.LogId
	  , ServerName  = s.ServerName 
	  , MessageDescription = m.MessageDescription 
	  , diagLog.DiagnosticCnt
	  , diagLog.DiagnosticStr
	  , diagLog.CreateDate
	  , s.CacheType
	  , s.ServerPort

	from dbo.EBCPDiagnosticLog diagLog
		inner join dbo.EBCPServer s
		on diagLog.ServerId = s.ServerId AND s.ServerId = @ServerIDParam
		inner join dbo.EBCPMessage m
		on diagLog.MessageID = m.MessageID
	WHERE ( DATEDIFF(hour,@StartDate,@EndDate ) <=24 AND @StartDate <= diagLog.CreateDate AND @EndDate >= diagLog.CreateDate)
	ORDER BY diagLog.LogId
End
GO

Have you read the stored procedures support section in documentation?

Marcus

yes, I can only execute SPROCS as the user. If I want to do EXECUTE statements how can I go about doing so?

You shouldn’t use grafana for that - not supported. Use your regular mssql management studio for example.

isn’t stored procedure supported? This is from the documentation. “EXEC dbo.sp_test_datetime @from, @to”. I think my problem is that my column isn’t named “time” but Grafana does support executing sprocs in mssql management studio?

Sorry I thought you we’re trying to execute the create stored procedure through Grafana. You need to return your date column aliased as as time just like in the documentation I referenced earlier. Also please note that the format of the returned time column must be in epoch millisecond format.