Adrian Torrie
Adrian Torrie

Reputation: 2844

Best way to rename indexes

I need to script (t-sql) renaming 3 indexes in a production data warehouse.

These 3 indexes are single column indexes that are on top of foreign key columns, i.e. Index 1 = Foreign Key 1.

What is the best way to rename these indexes via a script?

*What "gotchas" do I have to be weary of?

I'm aware of sp_rename, is this advisable, or should I drop and re-create the indexes with the new name (time isn't an issue)?

Upvotes: 4

Views: 2864

Answers (1)

Ben Thul
Ben Thul

Reputation: 32707

sp_rename will work fine and shouldn't break anything unless you have queries somewhere that reference the current name(s) in a query hint.

Upvotes: 4

Related Questions