Skip to content

Commit

Permalink
UPdate of SQL Script to remove unwanted testing comments and reformt …
Browse files Browse the repository at this point in the history
…CTEs for Stnadarization
  • Loading branch information
jonesgaohsu committed Jan 14, 2025
1 parent a1fda73 commit 1f41410
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ WITH ApprovedProtocols AS (
p.Three_Year_Expiration
FROM
onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p
INNER JOIN ApprovedProtocols ap
ON p.BaseProtocol = ap.BaseProtocol
AND p.Approval_Date = ap.maxApprovalDate)
,
ExpiredProtocol as (
Select d.*,p.protocol,p.enddate from DistinctProtocols d inner join ehr.protocol p on d.BaseProtocol = p.external_ID
where d.Protocol_StaTe != 'Approved' and p.enddate is Null)
INNER JOIN ApprovedProtocols ap ON p.BaseProtocol = ap.BaseProtocol
AND p.Approval_Date = ap.maxApprovalDate),
ExpiredProtocol AS (
Select
d.*,
p.protocol,
p.enddate
from DistinctProtocols d inner join ehr.protocol p on d.BaseProtocol = p.external_ID
where d.Protocol_State != 'Approved' and p.enddate is Null)

Update p
Set p.enddate = getDate() , p.contacts = 'EndDated based on Protocol_State ' + e.PROTOCOL_State

Set p.enddate = getDate()
from ehr.protocol p inner join expiredProtocol e on p.external_id = e.BaseProtocol
END

0 comments on commit 1f41410

Please sign in to comment.