Online Documentation for SQL Manager for SQL server

Foreign Keys


A Foreign key constraint (also called a referential integrity constraint) designates a column as the Foreign key and establishes a relationship between that foreign key and a specified Primary or Unique key called the referenced key. A composite Foreign key designates a combination of columns as the foreign key.

 

Table Foreign keys are managed within the Foreign Keys tab of Table Editor.

 

 

Creating Foreign Keys

 

To create a new Foreign key:

  • open the table in Table Editor;
  • proceed to the Foreign Keys tab there;
  • right-click the tab area and select the New Foreign Key context menu item, or press the Ins key;
  • define the Foreign key properties using the Foreign Key Editor dialog.

 

Editing Foreign Keys

 

To view/edit an existing Foreign key:

  • open the table in Table Editor;
  • proceed to the Foreign Keys tab there;
  • right-click the Foreign key to edit and select the Edit Foreign Key <foreign_key_name> context menu item, or simply double-click the Foreign key;
  • edit the Foreign key properties using the Foreign Key Editor dialog.

 

Dropping Foreign Keys

 

To drop a Foreign key:

  • open the table in Table Editor;
  • proceed to the Foreign Keys tab there;
  • right-click the Foreign key and select the Drop Foreign Key <foreign_key_name> context menu item;
  • confirm dropping in the dialog window.