p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Microsoft SQL Server 2008 Programming ISBN: 978-0-470-25701-2 (http://p2p.wrox.com/forumdisplay.php?f=425)
-   -   ALTER TABLE ADD CONSTRAINT (http://p2p.wrox.com/showthread.php?t=90040)

DJRomano May 13th, 2013 02:15 PM

Chapter 6: Constraints
Page 152

Entered the following code from the book:

USE Accounting

ALTER TABLE dbo.Employees
ADD CONSTRAINT FK_EmployeeHasManager
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?

All times are GMT -4. The time now is 12:31 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.