Not sure if this is possible but...
I have some sql syntax saved in a column as VARCHAR in a table that I would like to merge into a select statement as subselects in stored procedure, is this possible?
For example the code would look like this:
(SELECT col1 FROM tbl_2 WHERE tbl2.Id = tbl1.Id),
(SELECT col2 FROM tbl_2 WHERE tbl2.Id = tbl1.Id)
Where the subselects syntax is saved in tbl_3 column SQL.
This problem has come about from creating custom fields in my application to allow the user to add additional information. I would like to allow the user to flag if they would like to show this custom field on a search form. The only way I can get the correct info out is by using subselect. I have tried a dynamic pivot but could not join this to the main query as it would require defined column names for a table function.