The dynamic unpivoter.

  • Comments posted to this topic are about the item The dynamic unpivoter.

  • This seems very promising however of the 10 tables I tried in a customer's erp system it did not work on a single one. All 10 tables had a primary key. Also, you might want to change the alter to a create since the sp wont exist for whomever downloads it. If you release another version I would definitely be interested. Thanks for contributing!

    Tony

  • Hi Tony

    I updated the SP to be a create rather than an alter. I also tried running the SP on a new database that I have and it worked fine. One requirement is that the SP has to be on the same DB as the the table that you're going to pivot. Do you any get any errors? Let me know the steps that you're doing?

    Thanks

    John

  • Hi John,

    I've unpivoted NULLs quite successfully before. It just takes a value column that is NULLable to do it.

    And I'm a little concerned about your use of varchar(255) rather than sysname {nvarchar(128)} for column names, or nvarchar(256) for quoted column names.

    Similarly, I'm concerned about using varchar(255) for values, rather than nvarchar(255).

    It could cause collation or character translation issues for column names or values, which contain symbols or accented characters.

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

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