update tbl_TPM_Claims
set clearingTs =
where ownerId =
and ownerType =
and claimId =
and clearingTs is null
select c.claimId, c.claimDate, c.claimAmount, c.deductionRef, c.claimInvoice, c.claimRef, c.claimPeriodStart, c.claimPeriodEnd, c.claimStatus, c.claimStatusComment, c.claimStatusDate, c.claimStatusUserId, c.statusReasonId, coalesce( c.clearingTs, 0 ) clearingTs, coalesce( c.adminFee, 0.0 ) adminFee, c.processorUserId,
p.firstName as preparerFirstName, p.lastName as preparerLastName,
lu.firstName as lastUpdatedFirstName, lu.lastName as lastUpdatedLastName
from tbl_TPM_Claims c with (nolock)
left outer join tbl_FSPRO_Members p with (nolock)
on p.ownerId = c.ownerId
and p.fsl_tablecode = c.ownerType
and p.fspro_userId = c.processorUserId
left outer join tbl_FSPRO_Members lu with (nolock)
on lu.ownerId = c.ownerId
and lu.fsl_tablecode = c.ownerType
and lu.fspro_userId = c.claimStatusUserId
where c.ownerId =
and c.ownerType =
and c.claimId =
for json path, include_null_values