Udostępnij za pośrednictwem


Indexes/Keys Dialog Box

Use this dialog box to create or modify indexes, primary keys, and unique keys. To access this dialog box, open the table definition for the table with the index or key, right-click the table definition grid, and click Indexes/Keys.

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.

  • Selected Primary/Unique Key or Index
    Lists existing primary or unique keys and indexes. Select one to show its properties in the grid to the right. If the list is empty, none have been defined for the table.

  • Add Button
    Creates a new primary or unique key or index.

  • Delete Button
    Deletes the key or index selected in the Selected Primary/Unique Key or Index list.

  • General Category
    Expanded, shows the properties Is Unique and Type.

  • Is Unique
    Indicates whether data entered into this index or key must be unique. This is unavailable for XML Indexes.

  • Type
    Provides a drop-down list where you can specify whether the item selected in the Selected Primary/Unique Key or Index list is a unique key, a primary key, or an index. For primary keys this field is read-only.

  • Identity Category
    Expanded, it shows the property fields for Name and Description.

  • Name
    Shows the name of the key or index. When a new one is created, it is given a default name based on the table in the active window in Table Designer. You can change the name at any time.

  • Description
    Provides a place to describe the key or index. To write a more detailed description, click Description and then click the ellipsis (…) that appears to the right of the property field. This provides a larger area in which to write text.

  • Table Designer Category
    Expanded, shows information for Create as Clustered.

  • Create as Clustered
    Provides an option to make the key or index clustered. Only one clustered index is allowed on a table. Data in the table is stored in the order of the clustered index.

  • Data Space Specification
    Expanded, shows information for (Data Space Type), Filegroup or Partition Scheme Name, and Partition Column List.

  • (Data Space Type)
    Indicates whether this index or key belongs to a file group or partition scheme.

  • Filegroup or Partition Scheme Name
    Shows the name of the file group or partition scheme on which it is stored.

  • Partition Column List
    Displays a comma-separated list of columns that participate in the partition column function. Unavailable if Filegroup is selected in the (Data Space Type) field.

  • Fill Specification
    Expanded, shows information for Fill Factor and Pad Index.

  • Fill Factor
    Specifies what percentage of the index's leaf-level pages the system can fill. Once a page is full the system must split the pages if new data is added, impairing performance.

    • A value of 100 means the pages will be full and will take the least amount of storage space. This setting should be used only when there will be no changes to the data, for example, on a read-only table.

    • A lower value leaves more empty space on the data pages, which reduces the need to split data pages as indexes grow but requires more storage space.

  • Pad Index
    Indicates whether intermediate pages in this index are provided the same percentage of empty space (padding) specified in Fill Factor when they grow.

  • Ignore Duplicate Keys
    Controls what happens when a row whose key value equals an existing key value is inserted during a bulk insert operation. If you choose:

    • Yes    Table and Database Designer will display a SQL Server warning, ignore the offending incoming row, and try to insert the remaining rows.

    • No    Table and Database Designer will display a SQL Server error message and roll back the entire bulk insert operation.

  • Included Columns
    Displays a comma-separated list of the names of all the columns that constitute the index key. Sub-key columns can only be specified for nonclustered indexes. This property is hidden for XML indexes.

  • Is Disabled
    Indicates whether this index is disabled. This is a read-only property. This property will only be set to Yes if the index has been disabled in an outside tool, such as SQL Server Management Studio.

  • Is Full-Text Key
    Indicates whether this index is a full-text key. For more information on full-text keys, see SQL Server Books Online. This property is hidden for XML indexes.

  • Page Locks Allowed
    Indicates whether page-level locking is allowed on this index. Allowing or disallowing page-level locking affects database performance.

  • Re-compute Statistics
    Indicates whether the underlying database engine computes new statistics when the index is created. Re-computing statistics slows the building of indexes but will very likely improve query performance.

  • Row Locks Allowed
    Indicates whether row-level locking is allowed on this index. Allowing or disallowing row-level locking affects database performance.

See Also

Other Resources

Working with Indexes

Working with Constraints

Working with Keys