Pages

Tuesday, December 25, 2007

Changing Stored Procedure and View Names

There are times when you will need to change the name of a view or stored procedure after the object has been created. In the Enterprise Manager:

1. Right-click on the object, to show the available sub-menu options.
2. Select ‘Rename’.
3. Change the name of the object.

A word of caution is needed when performing this action. Renaming a stored procedure or a view does not change the name in the text of the definition (i.e. “Create Procedure ”, “Create View ”). To change the name of the text, you must modify the object directly.

If you do not make the proper modification, you will encounter a problem when you script the object. When the object is scripted, the name that appears in the text of the definition will become the name of the object. In this case, the object name will be reverted back to the original name.

No comments: