• peacesells (11/12/2013)


    The dynamic sql is pre-composed.

    Then I think you are stuck with your original query.

    IIRC There have been some posts suggesting using OPENROWSET with dynamic sql to avoid the use of the temp table, in which case you could wrap the @sql with an OPENROWSET query to avoid the temp table but not sure if performance will be better.

    Far away is close at hand in the images of elsewhere.
    Anon.