We have a lot of existing code that refers to table 'Purchases' Now are getting new clients and want to run the same code but using the new client's purchase tables (Purchases_ad,Purchases_nl etc).
So I thought a function fn_purchases(whichTable) would do the trick. The select statement would be 'select * from @tableName.'. But no go. I've tried select @query = 'select * from ' + @tableName. And a variety of other attempts that don't work.
Any hints how this might be done.