Create conditional select statement
Is there a clean way in SQL to conditionally create a select statement, based on a case statement?
I'm looking for the basic logic to be something like
CASE @tableToUse
WHEN 'Table1' SELECT * FROM Table1
WHEN 'Table2' SELECT * FROM table2
DEFAULT 'Table3' SELECT * FROM table3
END CASE