-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update of EiACUC P{rocessing for enddate
- Loading branch information
1 parent
52d2a69
commit d8f50eb
Showing
4 changed files
with
37 additions
and
84 deletions.
There are no files selected for viewing
63 changes: 33 additions & 30 deletions
63
onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-24.002-24.003.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
--This build is a stored preoccured that uses a temp table and then updates onprc_ehronprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS | ||
ALTER Procedure onprc_ehr.BaseProtocol | ||
|
||
AS | ||
--Create a Temp Table that creates Base Protocol and Revision Number | ||
WITH BaseProtocol AS ( | ||
SELECT | ||
RowID, | ||
Protocol_id, | ||
CASE | ||
WHEN LEN(protocol_id) > 10 THEN SUBSTRING(protocol_id, 6, 15) | ||
ELSE protocol_id | ||
END AS BaseProtocol, | ||
CASE | ||
WHEN LEN(protocol_id) > 10 THEN SUBSTRING(protocol_ID,1, 5) | ||
ELSE 'Original' | ||
END AS RevisionNumber, | ||
approval_date, | ||
Three_Year_Expiration, | ||
last_modified, | ||
Protocol_State | ||
FROM | ||
onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS | ||
) | ||
--This will update the onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS inserting the BaseProtocol and RevisionNumber | ||
Update e | ||
Set e.BaseProtocol = p.BaseProtocol, e.RevisionNumber = p.revisionNumber | ||
-- | ||
from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS e, BaseProtocol p | ||
where e.rowID = p.rowID | ||
ALTER PROCEDURE onprc_ehr.BaseProtocol | ||
AS | ||
BEGIN | ||
-- Create a Common Table Expression (CTE) named BaseProtocol | ||
WITH BaseProtocol AS | ||
( | ||
SELECT | ||
RowID, | ||
Protocol_id, | ||
-- Determine the BaseProtocol based on the length of the Protocol_id | ||
CASE | ||
WHEN LEN(Protocol_id) > 10 THEN SUBSTRING(Protocol_id, 6, 15) | ||
ELSE Protocol_id | ||
END AS BaseProtocol, | ||
-- Determine the RevisionNumber based on the length of the Protocol_id | ||
CASE | ||
WHEN LEN(Protocol_id) > 10 THEN SUBSTRING(Protocol_id,1, 5) | ||
ELSE 'Original' | ||
END AS RevisionNumber, | ||
approval_date, | ||
Three_Year_Expiration, | ||
last_modified, | ||
Protocol_State | ||
FROM onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS | ||
) | ||
|
||
-- Update the onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS table with BaseProtocol and RevisionNumber from the CTE | ||
UPDATE onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS | ||
SET BaseProtocol = BaseProtocol.BaseProtocol, | ||
RevisionNumber = BaseProtocol.RevisionNumber | ||
FROM BaseProtocol | ||
WHERE onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS.RowID = BaseProtocol.RowID; | ||
END | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-24.005-24.006.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters