

SQL SERVER RENAME COLUMN ARCHIVE
Object ‘Orders.OrderAmount’ cannot be renamed because the object participates in enforced dependencies. SQL Server Performance Forum Threads Archive Rename Column I have a table with plenty of rows. Introduction to PostgreSQL RENAME COLUMN clause First, specify the name of the table that contains the column which you want to rename after the ALTER TABLE. Msg 15336, Level 16, State 1, Procedure sp_rename, Line 444 This article describes standard naming conventions for tables and columns, and it provides code that leverages the conventions to visualize dependencies and automatically validate and generate foreign key constraints. Otherwise you will get the following error message: The third value is the type and here the type is column. The second value is the new column name that we want to change it to, in other words Name. If the column has a constraint, you must drop the constraint prior to renaming the column. The first value is the tblRename that is the table in which the column is to be renamed, as in 'Names' -> tblRename.Names. Make sure to check to see if any stored procedures are referencing the column prior to renaming it. This comes up as a reminder that the rename you just performed may have a negative effect on any stored procedures referencing the column. The syntax of sp_rename is the following:Įxec sp_rename ‘tablename.ColumnName’, ‘NewColumnName’, ‘column’ –objecttypeĮXEC sp_rename ‘Employees.FName’, ‘FirstName’, ‘column’Īfter executing the script above, you will receive the following informational message: In order to rename a column name, you must use sp_rename.
