Compartilhar via


How to: Delete Columns from a Table (Visual Database Tools)

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.

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.

To delete columns from a table

  1. In Object Explorer, right-click the table to which you want to delete columns and choose Design (Modify in SP1 or earlier).

    Table Designer opens.

  2. Select the column you want to delete.

  3. Right-click the column and choose Delete Column from the shortcut menu.

  4. 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 (Visual Database Tools)
How to: Insert Columns into Tables (Visual Database Tools)

Other Resources

Working with Columns (Visual Database Tools)

Help and Information

Getting SQL Server 2005 Assistance