Skip to main content
3 of 3
added 2 characters in body
Aleksey Vitsko
  • 6k
  • 5
  • 37
  • 68

Is there a way to apply a data compression to this table without dropping the primary key?

Yes you just need to run below command to rebuild the clustered index (in your case it is also PK):

ALTER INDEX [PK__t1__3BD0198E286DEFE4] on TABLE [t1] 
REBUILD with (ONLINE = ON, DATA_COMPRESSION = PAGE)

"ONLINE = ON" clause can help greatly reduce locking of table that is being rebuilt

Aleksey Vitsko
  • 6k
  • 5
  • 37
  • 68