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


IF @releaseId = 15 OR @releaseId = 16
BEGIN 
 insert into @temptbl 
EXEC('SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET NOCOUNT ON; SELECT ISNULL((SELECT CASE WHEN value = NULL or value = '''' THEN ''false'' ELSE ''true'' END FROM GXGlobalParam  WHERE name = ''DRCloudUserName''), ''false'') AS "DRBackup to cloud Enabled" ') 
 END
 
 SET @surveyXML = 
( SELECT 
(
SELECT [DRBackup to cloud Enabled] AS '@Col_-1258832511' FROM @temptbl
 FOR XML PATH ('cf_MetricsQuery10152'), 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')) 
