Search code examples
stored-proceduressql-server-2000

MSSQL2000: Using a stored procedure results as a table in sql


Let's say I have 'myStoredProcedure' that takes in an Id as a parameter, and returns a table of information.

Is it possible to write a SQL statement similar to this?

SELECT
    MyColumn
FROM
   Table-ify('myStoredProcedure ' + @MyId) AS [MyTable]

I get the feeling that it's not, but it would be very beneficial in a scenario I have with legacy code & linked server tables

Thanks!


Solution

  • You can use a table value function in this way.

    Here is a few tricks...