Created
December 5, 2022 17:17
Star
You must be signed in to star a gist
Multiple result sets
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
DECLARE @MasterObjects TABLE(Col1 INT, COL2 VARCHAR(24), ...) | |
INSERT INTO @MasterObjects | |
SELECT * -- Use only columns you need, not * | |
FROM MasterTable WHERE ID IN @MyIdList -- @MyIdList is table valued parameter populated with ids you want to pull | |
SELECT * -- Again only columns you need | |
FROM SideTable1 | |
JOIN @MasterObjects ON ... | |
SELECT * -- Ditto | |
FROM SideTable2 | |
JOIN @MasterObjects ON ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment