I\'ve got the following problem. My table (geo_table) structure is as follows:
geo_table
foreign_table_id | foreign_table_name | some_other_fields...
This should be done dynamically :
declare @tablename varchar(50) set @tablename = 'test' declare @sql varchar(500) set @sql = 'select * from ' + @tablename exec @sql