Skip to content

Commit a252649

Browse files
committed
OP-324: modify 'insuree to delete' variable
1 parent 4f658d6 commit a252649

2 files changed

Lines changed: 6 additions & 18 deletions

File tree

Empty databases/openIMIS_ONLINE.sql

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9978,15 +9978,9 @@ CREATE PROCEDURE [dbo].[uspConsumeEnrollments](
99789978
-- get the insuree which are not included in "insureeToProcess"
99799979
DECLARE @insureeToDelete TABLE(CHFID NVARCHAR(12))
99809980
INSERT INTO @insureeToDelete(CHFID)
9981-
SELECT CHFID
9982-
FROM (
9983-
SELECT CHFID FROM @insureeToProcess
9984-
UNION ALL
9985-
SELECT CHFID FROM @tblInsuree TI
9986-
) tbl
9987-
GROUP BY CHFID
9988-
HAVING count(*) = 1
9989-
ORDER BY CHFID;
9981+
SELECT IP.CHFID FROM @insureeToProcess IP
9982+
LEFT JOIN @tblInsuree I ON I.CHFID=IP.CHFID
9983+
WHERE I.CHFID is NULL
99909984

99919985
-- iterate through insuree to delete - process them to remove from existing family
99929986
-- use SP uspAPIDeleteMemberFamily and 'delete' InsureePolicy also like in webapp

Migration script/openIMIS migration latest.sql

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -675,15 +675,9 @@ CREATE PROCEDURE [dbo].[uspConsumeEnrollments](
675675
-- get the insuree which are not included in "insureeToProcess"
676676
DECLARE @insureeToDelete TABLE(CHFID NVARCHAR(12))
677677
INSERT INTO @insureeToDelete(CHFID)
678-
SELECT CHFID
679-
FROM (
680-
SELECT CHFID FROM @insureeToProcess
681-
UNION ALL
682-
SELECT CHFID FROM @tblInsuree TI
683-
) tbl
684-
GROUP BY CHFID
685-
HAVING count(*) = 1
686-
ORDER BY CHFID;
678+
SELECT IP.CHFID FROM @insureeToProcess IP
679+
LEFT JOIN @tblInsuree I ON I.CHFID=IP.CHFID
680+
WHERE I.CHFID is NULL
687681

688682
-- iterate through insuree to delete - process them to remove from existing family
689683
-- use SP uspAPIDeleteMemberFamily and 'delete' InsureePolicy also like in webapp

0 commit comments

Comments
 (0)