I am capturing the web request response success / failure of multiple URLs in a MSSQL table. This is captured every minute. For reporting, trying to display the success / failure status in a tabular form. Having issue in the select statement.
Table Structure:
[PingDateTime] [datetime2](7) NOT NULL,
[URLTested] [nvarchar](256) NOT NULL,
[ResponseCode] [char](1) NOT NULL,
[ExitStatus] [nvarchar](max) NOT NULL,
[TimeTakenInMS] [int] NOT NULL,
[StatusDescription] [nvarchar](max) NOT NULL,
[ResponseIP] [nvarchar](256) NULL
The select query i am trying is like the below.
select
b.URLTested,B.PingDateTime,
'00' = (case when max(datepart(MM,B.PingDateTime)) = 00 THEN 1 else 0 END)
'01' = (case when max(datepart(MM,B.PingDateTime)) = 01 THEN 1 else 0 END)
...
...
FROM URLPINGRESPONSEINFO B (nolock),
[EQUITAS_IT].[dbo].[M_URL_MONITOR] A (nolock)
where B.PingDateTime like '2022-06-04 00%'
group by b.URLTested, datepart(MM,B.PingDateTime)
order by URLTested, PingDateTime
The exact issue I am facing is in selecting the column "00" (which represents minutes).
In the output, I am trying to display the below column.
URL, Min 0 response code, Min 0 response time, Min 1 Response code, Min 1 response time,....Min 59 response code, Min 59 response time.
Basically trying to create a dashboard for the current hour. The column header that I wish to see in my output data is
URLTested, 00_ResponseCode,00_Exitstatus, 00_Timetakenin MS, 01_ResponseCode,01_Exitstatus, 01_Timetakenin MS..
There will be one entry for every URL for every minute.
Note: I cannot take every record in UI for display purpose due to the count.
Please suggest if there is an alternative for NOLOCK.