I am trying to write a stored procedure that joins a table or does unions that has the table name in another table:
ie, CREATE TABLE tables
(
@table varchar,
@foreignKey varchar
@data varchar
)
From here I would want to do something like:
SELECT *
FROM table1
union
SELECT *
FROM table2
union *
SELECT *
FROM table3
where the table1, table2 and table3 come from the tables table.
Thanks,
Tom
ie, CREATE TABLE tables
(
@table varchar,
@foreignKey varchar
@data varchar
)
From here I would want to do something like:
SELECT *
FROM table1
union
SELECT *
FROM table2
union *
SELECT *
FROM table3
where the table1, table2 and table3 come from the tables table.
Thanks,
Tom