select DISTINCT message from tbl_EAI_InboundBatches with (nolock) where message <> '' and queuestatus >= 300 and message not like 'processed%' and message not like '%reminders sent%' and message not like 'step%' and message not like '%success%' and message not like '%warnings/errors' and ownerId = and ownerType = order by message for json path, include_null_values