• Surely the only way you'd achieve this is with dynamic sql, which would be an absolute pig to maintain. Could you combine the various table you want to query into a single view, exposing the type too, then join on to the view?