What this means is if you have used table/column names in any script/stored procedure it will not be updated automatically, you will need to go through your scripts/stored procedures manually and update them accordingly. SQL Server is also nice enough to warn us that renaming an object can break scripts and stored procedures. You can verify that the changes have been made by issuing a SELECT against the table using new table name. Rename table tblProduct to Table_ProductsĮXEC sp_rename 'tblProduct', 'Table_Products'ĮXEC sp_rename 'Table_Products.ID', 'ProductID', 'COLUMN'ĮXEC sp_rename 'Table_Products.pName', 'ProductName', 'COLUMN'Ĭaution: Changing any part of an object name could break scripts and stored procedures. Now we can rename the Table Name and column names as below: You can rename below objects using sp_rename:ĭefault value for this parameter is TABLEįollowing example demonstrates how you can use sp_rename to rename table and column names: In MS SQL Server, you should utilize the stored. When renaming a column you need to specify table lumn name optionally you can also prefix schema name for the specified of the object. The technique to rename a section name in MS SQL Server is distinctive when contrasted with different databases. You can also rename using sp_rename system stored procedure. Method 2:Renaming an object using sp_rename: You can rename any object using object in Object Explorer. Right Click on the object in Object Explorer and select "Rename" Method 1:To rename an object using SQL Server Management Studio: To rename an object in SQL Server you can use sp_rename system stored procedure or you can do this via Object Explorer in SQL Server Management Studio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |