Database Reference
In-Depth Information
Note
sp_helptext
doesn't work with table objects. In other words, you can't see the definition of the
CREATE
TABLE
statement used while creating the table object.
Renaming Stored Procedures
SQL Server allows you to rename the objects. The following statement will allow you to change the
stored procedure name.
sp_rename
is a predefined stored procedure that allows to rename the objects.
Try It: Renaming a Stored Procedure
1.
Enter the following statement in the query pane:
sp_rename 'sp_Select_All_PersonContact,
'sp_Select_All_ContactDetails'
2.
Click Execute, and you will see the following message in the results pane:
Caution
Changing any part of an object name could break scripts and stored procedures.
Even though the stored procedure
sp_rename
has been executed successfully, it still shows the
caution message.
3.
Now go to the Object Browser, expand the AdventureWorks database node,
expand Programmability, right-click the Stored Procedures node, and select
Refresh.
4.
Expand the Stored Procedures node, and notice that
sp_Select_All_PersonContact has been renamed to
sp_Select_All_ContactDetails. You should see screen shown in Figure 6-8.