Working with Keys

A primary key is a constraint that assures that each table contains no duplicate rows. A foreign key is a constraint that enforces referential integrity. For more information about keys, see Keys.

For details about working with keys, see the following topics.

How to: Create Primary Keys

How to: Modify Primary Keys

How to: Delete Primary Keys

How to: Modify Foreign Key Relationships

How to: Delete Foreign Key Relationships

How to: View Foreign Key Properties

How to: Disable Foreign Key Constraints for Replication

How to: Disable Foreign Key Constraints with INSERT and UPDATE Statements

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.

See Also

Other Resources

Reference (Visual Database Tools)

Working with Relationships

Working with Constraints

Working with Indexes