• You could create a table valued function, which stores the values in a resultset.

    Temp tables wont be stored in here, but its almost the same...

    Sample Code:

    CREATE FUNCTION YourFunctionName (@VariablesYouNeedHere )

    RETURNS @RESULT_SET TABLE (YourFieldNamesAndTypesHere)

    AS

    BEGIN

    Insert into @RESULT_SET

    Select YourFieldNames

    from tablex

    where fieldy = @VariablesYouPassed

    RETURN

    END