How to Rebuild this Table

Experts,

 I have a table with ID (identity column) as primary key cluster.  There are additional columns eg, OrderHeaderNo I want to reorganize the rows on, to bring all existing order details together for each OrderHeaderNo. Do I build new table (with ID), select from old table with ORDER BY OrderHeaderNo, and load into new table, letting newtable.ID increment as it sees fit, then drop old table and rename new table ?

 Conversely - if I rebuild this table as it, it is going to use existing PK - the ID values as sort order and my order details will not be grouped together, it will just followed the chronologic order of the old rows ?  Then there is not much value in rebuilding after all.   This ought to be a common situation. I wonder how you handle this.  Thank you in ad

September 3rd, 2015 7:57pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics