Can I have an input paramater in a stored procedure be a table name?greenspun.com : LUSENET : SQL Server Database Administration : One Thread |
Can I have an input paramater in a stored procedure be a table name? If so, how do I use the paramater in the 'FOR' clause to set a cursor. Example: DECLARE curs CURSOR FOR SELECT @pTableName WHERE ...and so fourth?
-- Anonymous, September 07, 2000
Josh,You will need to use the EXEC statement within your stored procedure.
First, within the stored procedure, you will need to create a string that incorporates the passed in table name into your Transact SQL statement. Then you will need to call the EXEC statement with that string.
Good Luck,
Eric
-- Anonymous, September 07, 2000