• First thing first, awesome script, save me a lot of time!

    I tried running the script on a table that's set up as page compression, but the script didn't work, complaining the source / target table have mismatched compression options..

    I alter the script to this, and that solved the problem...

    If @IsCompressed>=1

    what happens is that the data_compression column in sys.partitions for my table is 2, not 1 as expected in the script, so I changed it to >=1, and it's been working fine now.

    Just sharing. thanks