Hi Friends, I have the following queries and I want to put them in an sql CASE statement so I would have only one query but I don't know how to do that. Can somebody help me?
IF (SELECT EtlLoadId
FROM ssislogs.audit.processcontrol
WHERE SubjectArea = 'UaqaFacetsImp') > 0
SELECT pc.SrcFileName + ' - '+ CONVERT(VARCHAR(10), pc.[RecordCount] ) AS FacetsImpCount
FROM ssislogs.audit.processcontrol pc left outer join
Uaqa.LettersAndCardsExports lc
on pc.etlloadid = lc.etlloadid
WHERE pc.subjectarea = 'UaqaFacetsImp'
ELSE
SELECT 'No input file' AS FacetsImpCount
SELECT pc.subjectarea AS FacetsRjctFile
FROM ssislogs.audit.processcontrol pc left outer join
Uaqa.LettersAndCardsExports lc
on pc.etlloadid = lc.etlloadid
WHERE pc.subjectarea = 'UaqaFacetsRjct'
SELECT pc.subjectarea AS FacetsPvsFile
FROM ssislogs.audit.processcontrol pc left outer join
Uaqa.LettersAndCardsExports lc
on pc.etlloadid = lc.etlloadid
WHERE pc.subjectarea = 'UaqaFacetsPvs'
Thanks