select ownerId, ownerType, batchId, fileFormat, config, batchTime, status, message, fileName, clientProcessEmail, fseProcessEmail, batchClass from tbl_EAI_InboundBatches with (nolock) where ownerId = 1 and ownerType = 'MFR' and dependentBatchId is null and batchTime >= cast( getDate() as date ) and fileFormat like '$RPC_1FS_Trade_DataExport%' and status = 'OK' order by batchId select string_agg( linkId, ',' ) claimIds from tbl_EAI_BatchHistory with (nolock) where linkType = 'TPC' and reference = '$RPC_1FS_Trade_DataExport' and ownerId = 1 and ownerType = 'MFR' and batchId =