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