Mass Renaming of Tables and Stored Procedures

纵然是瞬间 提交于 2019-11-30 23:10:58

SQLRefactor from RedGate has a smart rename feature. It updates all the references to the renamed objects!

See here:http://www.red-gate.com/products/SQL_Refactor/features.htm

I would use sp_rename for the tables.

For everything else, I would script the database, do a search and replace on the text file, and then execute the script back to your database:

In Management Studio, right click on the database name, then 'Tasks', then 'Generate Scripts'.

Don't script all objects in the selected database, just stored procedures, synonyms, user defined functions and views.

Also, make sure you set the following options: Script Drop, Script Object Level Permissions, Script Create.

I realize this is a little tedious, and it depends how many objects we're talking about, and (of course), I would do this is in development first, but I've used this process before and it works well.

There's a book on this and related subjects:

Refactoring Databases: Evolutionary Database Design

There are tricks that can help, and I think it's worth doing - but it ain't easy. Good luck!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!