Instant SQL Masterpieces

Some common operations if done in a classic way will take ages on big tables. That is why we do magic of instant changes, no matter how big the tables are. We use instant, metadata-level commands, for example: SWITCH, TRANSFER, TRUNCATE PARTITION, partitioning to 1 unlimited partition and back. Sometimes we copy a small amount of rows to keep, and some other clever tricks.

Change IDENTITY increment

Unfortunately, ALTER TABLE ALTER COLUMN does not allow changing of any identity property. DBCC CHECKIDENT does not have option to change the increment:  it can only change the seed using the RESEED option. What works is creating a cloned table with a desired increment, and switching the rows:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.