How to: Manage Columns in a Database (Devices)

The following steps assume that you have a SQL Server Compact 3.5 database available in the Server Explorer window. For more information, see How to: Create a Database (Devices).

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 Visual Studio Settings.

To add a column

  1. On the View menu, click Server Explorer.

  2. In the Server Explorer window, expand the data connection to display its tables.

  3. Right-click the table to which you want to add a column, and then click Edit Table Schema.

  4. In the Edit Table window, add the column and its properties, and then click OK.

To edit column properties

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data connection to display its tables.

  3. Right-click the table that contains the column whose properties you want to modify, and then click Edit Table Schema.

  4. Make your changes, and then click OK.

    Note

    You cannot make an edit that would violate referential integrity (for example, trying to change the Primary Key property to No when that column is referenced by another constraint).

To remove a column from a table

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data connection to display its tables.

  3. Right-click the table from which you want to remove the column, and then click Edit Table Schema.

  4. In the Edit Table window, select the column you want to delete, click Delete, and then click OK.

    Note

    You cannot remove a column until all references to the column are deleted.

See Also

Concepts

Using SQL Server Compact 3.5 Databases (Devices)

Other Resources

Column Properties