Created
May 4, 2020 06:21
-
-
Save davidsheardown/4505531ff527a3635fda8ef70b5f217b to your computer and use it in GitHub Desktop.
Compare Row Count of Lines to Batch Header Count
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
/* | |
Quick query to compare a count total at header level to line count of successful rows i.e. 1 -> Many integrity check | |
to ensure the correct row count of lines matches header | |
*/ | |
select | |
sph.Id, | |
sph.Filename, | |
sph.Status, | |
sph.CreatedAt, | |
case when sph.BatchRowCount = ( | |
select | |
count(Id) | |
from | |
MyLines spl | |
where | |
spl.Status = 'Imported' | |
and | |
spl.HeaderId = sph.Id | |
) then 1 else 0 end as BatchCountMatched | |
from | |
MyHeader sph | |
where | |
sph.status = 'Imported' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment