dynamic pivot table

  • Hello

    I need to know if it´s possible build a TSQL pivot table to increase new columns header fields dynamicaly.

    for example : TotalSales by vendors an countries on my invoices. 

     New JerseyCanadaFrancePortugal
    paul100   
    luis 15  
    lisa10   

    if in my table country i insert a new country , and i make sales to them on some invoices, i need automaticaly my TSQL pivot table add this new one.

    Maybe to simplify , i need all the countries of my countries tables , and only have data on columns where my vendors have sales.

    it´s simple im ACCESS but in SQL i don´t know how to do this

    Many thanks

    Luis Santos

  • Yes, but you have to use dynamic SQL to do it.  I posted a sample on here not too long ago how I do it.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply