USE SQL2008SBS
GO

--Must drop foreign key first, because it depends on the primary key
ALTER TABLE Orders.OrderDetail
    DROP CONSTRAINT fk_orderheadertoorderdeatils
GO   
--Change the existing primary keys to nonclustered
ALTER TABLE Orders.OrderHeader
    DROP CONSTRAINT pk_orderheader
GO
ALTER TABLE Orders.OrderHeader
    ADD CONSTRAINT pk_orderheader PRIMARY KEY NONCLUSTERED (OrderID)
GO
ALTER TABLE Orders.OrderDetail
    DROP CONSTRAINT pk_orderdetail
GO
ALTER TABLE Orders.OrderDetail
    ADD CONSTRAINT pk_orderdetail PRIMARY KEY NONCLUSTERED (OrderDetailID)
GO
--Recreate the foreign key (fix the misspelling from chapter 5)
ALTER TABLE Orders.OrderDetail
    ADD CONSTRAINT fk_orderheadertoorderdetails FOREIGN KEY (OrderID)
    REFERENCES Orders.OrderHeader (OrderID)    
GO
--Create new clustered indexes on the ShipDate/FinalShipDate columns
CREATE CLUSTERED INDEX icx_finalshipdate ON Orders.OrderHeader (FinalShipDate)
GO
CREATE CLUSTERED INDEX icx_shipdate ON Orders.OrderDetail (ShipDate)
GO
