I have a stored procedure that needs to refer to one of two tables depending on the value of a parameter. Here's what I know and don't know how to do:
Thank you for your help.
Code:
DECLARE @ThisQuery varchar(8000)
SET @ThisQuery = 'Select * '
SET @ThisQuery = @ThisQuery + 'FROM '
(Here, I need to be able to append different table names depending on the value of a parameter)
EXEC(@ThisQuery)