linercrush.blogg.se

Sql server rename column
Sql server rename column









EXEC sp_rename '', 'ErrorDateTime', 'COLUMN' The following example renames the column ErrorTime in the table dbo.ErrorLog to ErrorDateTime in the AdventureWorksLT database. Select the column whose name you want to change and type a new value for Name. You can also change the name of a column in the Column Properties tab.

  • On the File menu, select Save table name.
  • Under Column Name, select the name you want to change and type a new one.
  • In Object Explorer, right-click the table to which you want to rename columns and choose Design.
  • In Object Explorer, right-click the table in which you want to rename columns and choose Rename.
  • In Object Explorer, connect to an instance of Database Engine.
  • Use SQL Server Management Studio Rename a column using Object Explorer

    sql server rename column

    Refresh the metadata using sp_refreshsqlmodule or sp_refreshview. For example, if you rename a table column and that column is referenced by a non-schema-bound view or function that SELECTs all columns (using the *), the metadata for the view or function continues to reflect the original column name.

    sql server rename column

    SQL SERVER RENAME COLUMN UPDATE

    Renaming a column doesn't automatically update the metadata for any objects which SELECT all columns (using the *) from that table. Use sys.sql_expression_dependencies to list dependencies on the object before renaming it.

    sql server rename column

    For example, if you rename a table column and that column is referenced in a trigger, you must modify the trigger to reflect the new column name. You must modify any objects that reference the renamed column manually. Renaming a column won't automatically rename references to that column. You can rename a table column in SQL Server by using SQL Server Management Studio or Transact-SQL.









    Sql server rename column