In a sense it is possible if the exec returns the same columns as the selects you can create a new procedure
create procedure p_select_and exec as
begin
SELECT blah1, blah2, blah3
FROM table1
UNION ALL
SELECT blah1a, blah2a, blah3a
FROM table2
EXEC SomeValidStoredProc --which returns records like blahX, blahY, blahZ
end
exec p_select_and_exec will return a single result with the SELECTS combined with the exec.
(At least I believe it will but I don't think I have ever actually done it.)
Main Topics
Browse All Topics





by: arbertPosted on 2004-10-25 at 19:33:56ID: 12406986
No, you would have to perform the exec into a temporary table first and then union the results. Either that, or possible use a UDF.