How to: Delete Columns from a Table
When you delete a column from the table in Table Designer, once you save the changes, it and all the data it contains are deleted from the database.
Note
A new version of Table Designer appears for databases in the SQL Server 2012 format. This topic describes the old version of Table Designer, which you use with databases in earlier formats of SQL Server.
In the new version, you can change a table definition through a graphical interface or directly in a script pane. If you use the graphical interface, the table’s definition is automatically updated in the script pane. To apply the SQL code in the script pane, choose the Update button. For more information about the new version, see How to: Create Database Objects Using Table Designer.
Warning
This action cannot be undone once the table is saved. The only way to restore a deleted column is to close the table without saving changes.
Note
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.
To delete columns from a table
In Server Explorer, right-click the table from which you want to delete columns and choose Open Table Definition.
The table opens in Table Designer.
Select the column you want to delete.
Right-click the column and choose Delete Column from the shortcut menu.
If the column participates in a relationship, a message prompts you to confirm the deletion of the selected columns and their relationships. Choose Yes.
If the column does not participate in a check constraint, then the column, any constraints attached to it, any relationships it participates in, and any data contained in the column are provisionally removed from the database. They are permanently deleted from the database when you save the table.
If the column does participate in a check constraint, the database server will reject your modification when you try to save your work. That is, the commit operation will fail. To delete a column that participates in a check constraint, you must first modify or remove the check constraint before you can delete the column.
See Also
Tasks
How to: Delete Tables from a Database
How to: Insert Columns into Tables