• dwilliscp (7/25/2014)


    I have a massive table (company, plant, resource, part number) that I need to create a from part number, to part number for every part within "Company, Plant, Resource" combo.

    Trying to figure out what the best method would be.. using a cursor will put the load on one CPU and take way too long.

    Ideas?

    You have one table... lets call it Resource_Mat. PK Company, Plant, Resource, Part Number. What I need to do is ..

    Get the first row from Resource_mat and for every row in the table create a data set that contains:

    Company, Plant, Resource, [Selected rows' part number], [current rows' part number]

    The only restriction is that the loop needs to only work on where Comany + Plant + Resournce matches between selected row and current row.

    This is why I thought about using a cursor.. but the data set is so large, and SQL will throw it all on one CPU... I expect it to take too long.

    The result of the above query then gets updated/inserted into a table that holds this information about from part .. to part and then we keep up how long it takes to transitition from one part number to a different part number.