How to: Insert Columns into Tables

Use Table Designer to add new columns to a table. When you open a table in Table Designer, you see all of its currently defined columns as well as a blank row at the bottom of the table definition grid. You can add columns either in the blank row or you can insert them between existing rows.

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.

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 insert columns into a table with Table Designer

  1. In Server Explorer, right-click the table into which you want to add columns and choose Open Table Definition.

    The table opens in Table Designer.

  2. Right-click a row in the table and select Insert Column from the shortcut menu. A blank column row is inserted.

    -or-

    Place the cursor in the first blank cell in the Column Name column.

  3. In the Column Name column, type the column name in the cell. The column name is a required value.

  4. Press the TAB key to go to the Data Type cell and select a data type from the dropdown. This too is a required value, and will be assigned the default value if you don't choose one.

    Note

    You can change the default value in the Options dialog box under Database Tools.

  5. Continue to define any other column properties in the Column Properties tab.

    Note

    The default values for your column properties are added when you create a new column, but you can change them in the Column Properties tab.

See Also

Other Resources

Working with Columns

Working with Tables in Table Designer