SQLServer – Error Message – Alter Table Switch Statement failed – There is no identical index in source table

Introduction

Sometimes you will get the error pasted below when you try to issue a “Switch Partition

Error Message

Alter Table Switch Statement failed – There is no identical index in <source-table> for the index <index> in <target table>

Code


truncate table <target-table>

     alter table <source-table> 
         switch partition 1 to <target-table> PARTITION 1

truncate table <target-table>

Remediate

To correct:

  • Make sure that both the source and target tables have the Index referenced in the error statement
  • Also make sure that the indexes are defined accordingly in both cases
  • Ensure that the indexes characteristics match. i.e. Enabled

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s