I have a variables/drop down of servers and serverports. I want to call a sproc per each combination of servers and serverports. This works in SQL server but not in Grafana. It only calls the first sproc.
DECLARE
@StartDate datetime,
@EndDate datetime,
@i int, @j int, @ServerId smallint, @ServerName VARCHAR(100), @ServerPort VARCHAR(100)
SET
@StartDate = DATEADD(HH,-1, GETDATE())
SET
@EndDate = GETDATE()
SET
@ServerName ='[[ServerName:csv]]'
SET
@ServerPort = '[[ServerPort]]'
select @i = 1
while @i < len(REPLACE(@ServerName,',','')) + 1
begin
set @j = 1
while @j < len(REPLACE(@ServerPort,',','')) + 1
begin
declare @ServerIDFromQuery smallint = ( select ServerID from Server where ServerName = (select * from dbo.fnSplit(@ServerName, ',' ,@i)) and ServerPort = CAST((select * from fnSplit(@ServerPort , ',' ,@j)) as int))
execute DiagnosticLogGetGrafana @StartDate , @EndDate, @ServerIDFromQuery, 18
set @j = @j + 1
end
set @i = @i + 1
end
How would I go about calling a sproc per each combination of servers+ports selected?