Pivoting a large amt of columns without aggregation

  • I have a job route table containing every job and it's operation number/description. I've been tasked to list out every job number with its operation number, operation description, and the current operation the job is on. Here's the catch... Job operation numbers usually start at 10 and increment by 10. The number of operations varies from job to job. One job can have 16 operations (10, 20, 30, .......... 140, 150) and the next job 7 operations (10, 20, 30 ... 70). Every now and then there are oddball jobs that will have operations in between the usual operation numbers. For example, Job ABC has 9 operations 10, 11, 12, 13, 20, 30, 40, 45, 50.

    I'm thinking about tackling this situation with a pivot table. The downfall of this solution is the amount of columns needed to produce the results. I've created a pivot table without aggregation, but with only 20 columns. The tricky part is to create a pivot and capture every job and the operations used between 10 and 200. My worry is the effect it may have on performance/efficiency. Any advice is appreciated. Thanks!

  • This article about dynamic pivots and cross tabs could help you.

    http://www.sqlservercentral.com/articles/Crosstab/65048/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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