I need to get the table name to query from a table.
var tableName = "select tableName from tableList where type='A';"
Then subsequently use that table name in another query.
"select * from" + tableName
Transact SQL/stored procedures are new to me in general so any help would be appreciated. I didn’t design the database and unfortunately can’t really change it to be a better design as much as I would love to!
My question is – is this possible from one stored procedure and if so can anyone mock up how I’d do it.
Or if there are any better ways anyone can think of (bar redesigning the database!)
Thanks
Maybe via dynamic SQL