• @steve-2:

    The disadvantage of your solution is that you have to have a aclumn named "deed_name" within each table you want to apply that dynamic query to.

    Therefore, I decided to use a variable for the OVER clause, too.

    It's also easier to control the order of the output values. Example: You could easily run it with

    @V_ORDER_BY_QUERY = 'ORDER BY deed_name DESC '

    without any changes to the dynamic part.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]