-- Drop Index First
DROP INDEX [idx_tbTable01_Col01_Col02] ON [dbo].[tbTable01]

-- Alter Table
ALTER TABLE [dbo].[tbTable01] DROP
COLUMN [Col12]
ALTER TABLE [dbo].[tbTable01] ALTER COLUMN [Col13] [datetimeoffset] NOT NULL

-- Recreate Index
CREATE NONCLUSTERED INDEX [idx_tbTable01_Col01_Col02] ON [dbo].[tbTable01] ([Col01], [Col02]) INCLUDE ([Col03], [Col04], [Col05], [Col06])

Example Stats:

85 million records = 4 to 11 minutes

Last modified: July 16, 2020

Author

Comments

Write a Reply or Comment