Need to use the contents of a field as a table select. For example, my table (ATest) contains a field name (selection_id). The contents of the field contains a table name (selection_12345) that I need to query to obtain the contents of selection_12345. How can I pass the contents as a table name in another select?
I'm trying to do a
If you only return a single row, you can set a variable like this:
Then, you would have to create a dynamic T-SQL statement to execute the second query:
Those are examples. You would want to be careful to ensure you can't get SQL Injection