Rename column SQL Server 2008

前端 未结 12 2167
名媛妹妹
名媛妹妹 2020-11-27 08:52

I am using SQL Server 2008 and Navicat. I need to rename a column in a table using SQL.

ALTER TABLE table_name RENAME COLUMN old_name to new_name;

12条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 09:43

    Alternatively to SQL, you can do this in Microsoft SQL Server Management Studio. Here are a few quick ways using the GUI:

    First Way

    Slow double-click on the column. The column name will become an editable text box.


    Second Way

    Right click on column and choose Rename from the context menu.

    For example:

    To Rename column name


    Third Way

    This way is preferable for when you need to rename multiple columns in one go.

    1. Right-click on the table that contains the column that needs renaming.
    2. Click Design.
    3. In the table design panel, click and edit the textbox of the column name you want to alter.

    For example: MSSMS Table Design Example

    NOTE: I know OP specifically asked for SQL solution, thought this might help others :)

提交回复
热议问题