PIVOT of varchar alters the value

  • I am trying to do a simple rotation/pivot of a database table using the PIVOT command. The column is a varchar, but all the column values become 1 after the pivot. Every example I have seen performs pivots on numeric columns. Does pivot not work with varchars? I don't see this restriction mentioned in the BOL.
     
    Thank you,
    Mike
  • Can you post the query please? Table structure and sample data also, if possible.

     

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I typed up a simple example in response and discovered that my simple example worked. So I must have done something wrong initially.

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

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