• You have to apply the ISNULL() function to your outer SELECT statement. That means you cannot use a SELECT *.

    Unfortunately, your sample data and your query don't match (columns [Columns] and [ TOTAL] are missing, content of @Columns is not defined).

    Otherwise we would have been able to show you an example based on your data.



    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]