I'm no expert but this sounds like a job for dynamic SQL - or else some programmatic solution. Good luck and let us know what you find in the manual.