Share via


Managing Database Objects with OLE DB (SQL Server Compact Edition)

Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) requires that an object must be opened exclusively before modifying it.

Modifying Objects

All ITableDefinition methods open tables for exclusive access. If another method already has the table open, the ITableDefinition method call fails. For example, if a user tried to add a column to a table by using ITableDefinition::AddColumn while a cursor was open on that table, the attempt to modify the definition of the column would fail with a locking error. You must consider locking issues when you design your application, particularly when you use transactions.

Modifying Columns

Some information about columns can also be modified using IAlterTable::AlterColumn. Because columns have more items that could potentially be modified, the DBPROP_ALTERCOLUMN property describes the parts of the DBCOLUMNDESC structure defining the column that can be modified. However, even if the provider supports modifying properties, this does not imply that all properties can be modified. The following properties can be modified through the OLE DB Provider for SQL Server Compact Edition:

  • DBPROP_COL_DEFAULT
  • DBPROP_COL_SEED (only on identity columns)
  • DBPROP_COL_INCREMENT (only on identity columns)

Modifying Indexes and Constraints

You can also modify indexes and constraints. For more information, see OLE DB Indexes (SQL Server Compact Edition) and OLE DB Constraints (SQL Server Compact Edition).