Multiple queries in stored procedure [duplicate]
Possible Duplicate:
SQL CASE statement
Hi Frdz, i have created a stored proc and i put three queries in stored proc with inputvariable @EtlLoadId = 0 and i get three different windows for each query under result tab. is there any chance i can get results from the stored proc (results of three queries) as only one window and results one below another under result tab ?
IF (SELECT EtlLoadId
FROM ssislogs.a开发者_JAVA技巧udit.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
Assuming SQL Server based on some clues, use text mode, not grid mode in SSMS
Before executing:
- Control+T = text mode
- Control+G = grid mode
It makes no different to the actual execution: 3 result sets returned.
Set your query results window to view as text and all three will be together.
精彩评论