DECLARE @LogDate AS BIGINT = dbo.GetUnixTime(GETUTCDATE()) 
DECLARE @queryId AS INTEGER = 10308
DECLARE @surveyXML nvarchar(MAX) 
 
DECLARE @releaseId integer 
SET @releaseId = (select releaseId from APP_Client where id = 2) 
 
DECLARE @temptbl table 
(
[LSR Enabled] nvarchar(max)
)


IF @releaseId = 16
BEGIN 
 insert into @temptbl 
EXEC('SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET NOCOUNT ON; SELECT 
CASE enabled 
WHEN 1 THEN ''Yes''
ELSE ''No''
END AS ''LSR Enabled'' FROM msdb.dbo.sysjobs WHERE (name = N''Execute LSR Master'') ') 
 END
 
 SET @surveyXML = 
( SELECT 
(
SELECT [LSR Enabled] AS '@Col_-452064340' FROM @temptbl
 FOR XML PATH ('cf_MetricsQuery10308'), type
)
  FOR XML PATH ('SurveyResults') 
)

DECLARE @EndTime AS BIGINT = dbo.GetUnixTime(GETUTCDATE()) 
SET @outputXML = (SELECT @queryId AS '@QueryId', @EndTime AS '@LogDate', (@EndTime - @LogDate) AS '@QueryRunningTime', @surveyXML FOR XML PATH('Rpt_CSSXMLDATA')) 
