• You may also need to use dynamic SQL. It's really difficult to tell without DDL, sample data, and expected results to work with.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA