Dotnet C# ASP.NET Welcome Guest !
login |
Home Tutorials Articles Code Snippets Interview Questions Forums LocationMap Mobile Tracker Route Maps ContactUs

Top Contributors

VamsiKrishna
MuraliKrishnaS
AnilKumarGupta
satishkumar
balajibalajibalu

Monthly Winners

Award Details
Twitter Facebook Google+ Linkedin
Post Articles | Post CodeSnippets | Post Interview Questions | Post Question | Post Feed Back
 
OnlineExam | BangloreInstitutions | Jobs Learn about Membership Level & Points
Article Name: SP Rename
Posted By: MuraliKrishnaS Posted on: 03 Jul 2014 No.Of Visitors: 78 Author website: www.dotnetchallengers.com    
Summary : Here am explaining how to rename a Stored Procedure

Introduction:

        Wheneverwe have to change anything in the database we mostlyuse Management Studio and do the changes. In this article I amgoing to demonstrate the use of "sp_rename" stored procedure. It isused to rename any user created objects in SQL Server.

Description:

       Whenwe say re name then this object can be anything, it can be table, column,index, alias, datatype or any user defined data type in Microsoft .NETFramework CLR. But using this there can several issues like, ourexisting scripts and stored procedure will fail to run as it will throw anerror for used object(s) as they got renamed. It is advised to use this storedprocedure for renaming the stored procedures, triggers, user-defined functionsor views, rather than dropping and recreating that object. 

Usage:

sp_rename'[old_object_name]','[new_object_name]','[object_type]' 

Arguments:

old_object_name - Thisis a qualified or unqualified name of the user created object. If we want torename a column of a table then it should be specifiedas 'table.column' or 'schema.table.column' andsame goes for index. It does not have any default value, so we have to specifysome value in the quotation. 

new_object_name - Itsa new name of the object which should being single part and must follow therules for identifiers. It also does have any default value. 

object_type -This is a type of object being renamed.

 

Copyright © DotnetChallengers, Bangalore

  Feed Back Of Users ContactUs SearchMembers Back To Top