Assuming you only need to keep reading available: you can do the little-known partition/table switching trick.
First create an exact copy of the table definition: the column definitions must all be the same (apart from IDENTITY
), the clustered and non-clustered indexes must be the same, the filegroups must be the same, all primary, unique, foreign and check constraints must be the same.
Then do the following:
SET XACT_ABORT ON;
BEGIN TRAN;
INSERT NewTable (ColumnsHere)
SELECT ColumnsHere
FROM OldTable WITH (TABLOCK);
TRUNCATE TABLE OldTable;
ALTER TABLE NewTable SWITCH TO OldTable;
COMMIT;
Finally drop the new table.