Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 235
John Avatar asked Mar 02 '23 02:03

John


1 Answers

You can use a table value function in this way.

Here is a few tricks...

like image 196
StingyJack Avatar answered Mar 23 '23 14:03

StingyJack