Assigning column headers at runtime.

  • Hi,

    I 've got a query where where my result consists of a [Product Code] column, followed by three fields ([Month1],[Month2],[Month3]), which is the past 3 month's total movement, for that a product.

    My table only has the following fields: [Dated],[prodct Code],[Movement].

    I use case statments to get the required results, which is perfect.

    To finish off my query, I want to assign field headers for results which looks some like: [March 2004],[April 2004],[May 2004] etc, by using declared variables or similar.

    Does anyone know how to assign column headers at runtime?


    Robert

  • Well this can be done using Dynamic SQL however you may want to get yourself clear if you want to go with dynamic SQL or not and it also requires a temp table inside a SP so if you are ok with Dynamic SQL I will post the script for it.

    Thanks.

    Prasad Bhogadi
    www.inforaise.com

  • Please post that script, I'll give it a try.

    Thanks


    Robert

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

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