Table Names as Parameters for Stored Procedures
Posted on 1998-08-07
How do I pass a table name as a parameter to a stored procedure? When I use variables passed as parameters in most contexts, I have no problem(i.e. Select * from Titles Where L_Name Like @lastName). But I can't find a way to use variables in the 'From' clause(i.e. Select * from @tableName).
I've been able to build Sql strings and execute them using the 'exec' command, but with this approach I'm unable to use the results of the dynamically executed query in the continuation of my stored procedure.