Primary keys

A primary key constraint designates a column as the primary key of a table or view. A composite primary key designates a combination of columns as the primary key. A primary key combines a Not Null and unique constraint in one declaration. Therefore, to satisfy a primary key constraint no primary key value can appear in more than one row in the table, and no column that is part of the primary key can contain a Null. A table or view can have only one primary key.

To Create a Primary Key

Open the table you need and choose New Primary Key from the Table menu. Add required columns to the key and click OK. You can also switch to the Constraints tab and create the primary key within shortcut menu.

To Edit a Primary Key

Navigate to the key in Database Explorer and double-click it or open the table that owns the primary key, switch to Constraints tab and choose Edit Constraint from shortcut menu.

Note
The already created Primary key can be edited only on the Constraints page. The Primary check box is inactive on opening a column.

To Drop a Primary Key

Navigate to the key in Database Explorer and, and then click Delete on its shortcut menu. Alternatively, open the table that owns the primary key, switch to the Constraints tab, and then click Delete Constraint on the key shortcut menu.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Studio in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Studio for your business, request a demo to see it in action.
Ready to start using dbForge Studio for SQL Server?