ALTER TABLE ADD CONSTRAINT
Chapter 6: Constraints
Page 152
Entered the following code from the book:
USE Accounting
ALTER TABLE dbo.Employees
ADD CONSTRAINT FK_EmployeeHasManager
FOREIGN KEY (ManagerEmplID)
REFERENCES dbo.Employees(EmployeeID)
I receive the following msg:
Msg 547, Level 16, State 0, Line 3
The ALTER TABLE statement conflicted with the FOREIGN KEY SAME TABLE constraint "FK_EmployeeHasManager". The conflict occurred in database "Accounting", table "dbo.Employees", column 'EmployeeID'.
When I execute EXEC sp_helpconstraint Employees, the only constraint that appears is the PRIMARY KEY. I can't identify anything in sp_helpdb that would prevent me from doing this.
Can somebody help me?
|