automate table creation from existing table

  • I have a database with many partitioned tables and I periodically need to switch out partitions. I have been maintaining copies of the partitioned tables for the switch out operations, however this is a tedious and error prone process as someone may change a table and the switch out operation fails.

    I wrote a script that reads all table attributes, including indexes, constraints, etc., to automatically build a table that is identical to the source partitioned table to receive the switched out partition. However, I feel I may have missed something. Is there a tool or "easy" way to guarantee that I have an identical table to the partitioned table that can be added to an automated process?

    Thanks in advance for any insight.

  • You might want to look at SQL Compare by Red Gate Software. It can compare objects between two databases, between scripts and a database, backup and a database or source control and a database (or all of the above to each other). That can absolutely show if you've got everything correct.

    Disclosure, I work for Red Gate. but I used their software as a DBA for about 12 years before I started working for them.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply