use [test1_AlplaPROD2.0_Read] SELECT --JSON_VALUE(content, '$.EntityId') as labelId a.id ,ActorName ,FORMAT(PrintDate, 'yyyy-MM-dd HH:mm') as printDate ,FORMAT(CreatedDateTime, 'yyyy-MM-dd HH:mm') createdDateTime ,l.ArticleHumanReadableId as av ,l.ArticleDescription as alias ,PrintedCopies ,p.name as printerName ,RunningNumber --,* FROM [support].[AuditLog] (nolock) as a left join [labelling].[InternalLabel] (nolock) as l on l.id = JSON_VALUE(content, '$.EntityId') left join [masterData].[printer] (nolock) as p on p.id = l.PrinterId where message like '%reprint%' and CreatedDateTime > DATEADD(minute, -[intervalCheck], SYSDATETIMEOFFSET()) and a.id > [ignoreList] order by CreatedDateTime desc