Advertisement
Ruslan_Rayanov

project trace in syssp/hour

Feb 22nd, 2023
1,865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.64 KB | None | 0 0
  1. if(DATEPART(HOUR, GETDATE())=23) begin
  2.       BEGIN TRY  
  3.         declare @minID int = (select top 1 id from as_trace where cast(created as date) = cast(getdate() as date))
  4.         declare @p ExtendedDictionaryParameter
  5.         insert into @p ([Key], value2)
  6.         select '',  code + ','+ cast(count(*) as nvarchar) from as_trace
  7.         where id>=@minID
  8.         group by code
  9.         order by code desc
  10.  
  11.         select 'apirequest' type,
  12.           'diag' code, 'data' p1_name, isnull(dbo.as_agg(@p, '||'), '') p1_value, 'p' p2_name, 'xxx' p2_value
  13.       END TRY  
  14.       BEGIN CATCH  
  15.           print error_message()
  16.       END CATCH
  17.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement