DBHawk Tutorials

This section contains the features and various tutorials to show how to do various database tasks with DBHawk

SQL Server Add Foreign Key Constraints


DBHawk includes an Add Foreign Key Constraints feature.


After creating SQL Server Table, you may want to add Primary and Foreign Key constraints.

The add column part in the wizard let me add the default constraints, but I want a foreign key from ManagerID to EmployeeID.   Checked the ‘Options’ drop down and found what I needed.


First, add new Primary Key Constraint.

sql-server-add-constraints

SQL Server Add Constraints


Clicked on the ‘Constraints’ menu and up popped the ‘New Constraint’ wizard.  Created a primary key on EmployeeID and then created a foreign key from ManagerID to EmployeeID.  The tool went ahead and created a unique clustered index on the primary key.

sql-server-add-foreign-key

SQL Server Add Foreign Key


For more details about how to create foreign key relationships visit MS SQL Document