How to: Specify Table and Index Options

You can specify table options and index options in the table and index definitions in your database project. For more information about the supported table options and their values, see sp_tableoption (Transact-SQL). For more information about supported index options and their values, see sp_indexoption (Transact-SQL).

To specify table options

  1. Open your database project in Visual Studio Team System Database Edition.

  2. In Solution Explorer, double-click the table for which you want to specify a table option.

    The Transact-SQL (T-SQL) editor appears and displays the definition for the table.

  3. Following the table definition in the T-SQL script, add the following T-SQL statement:

    EXEC sp_tableoption 'TableName', 'OptionName', OptionValue
    go
    
  4. On the File menu, click SaveQualifiedTableName**.table.sql**.

    You should now be able to build and deploy the database project. If any tables in your database project use the vardecimal storage format, the database option for vardecimal storage will be enabled automatically. For more information, see sp_db_vardecimal_storage_format (Transact-SQL).

    Note

    Vardecimal storage format requires at least Microsoft SQL Server 2005 Service Pack 2 and is available only in SQL Server 2005 Enterprise, Developer, and Evaluation editions.

To specify index options

  1. Open your database project in Database Edition.

  2. In Solution Explorer, double-click the index for which you want to specify an index option.

    The Transact-SQL (T-SQL) editor appears and displays the definition for the index.

  3. Following the index definition in the T-SQL script, add the following T-SQL statement:

    EXEC sp_indexoption 'IndexName', 'OptionName', OptionValue
    go
    
  4. On the File menu, click SaveQualifiedIndexName**.table.sql**.

    You can now build and deploy the database project.

See Also

Tasks

How to: Create a Database Object

How to: Prepare Database Build Scripts

Concepts

Terminology Overview of Database Edition