Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Microsoft SQL Server 2008 Programming ISBN: 978-0-470-25701-2 Discuss the book Beginning Microsoft SQL Server 2008 Programming, Robert Vieira, ISBN: 978-0-470-25701-2
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft SQL Server 2008 Programming ISBN: 978-0-470-25701-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 13th, 2013, 02:15 PM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question 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?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alter Table statement to add Foreign Key Keith Broadbent MySQL 1 February 10th, 2012 08:04 AM
Alter Table statement to add Foreign Key Keith Broadbent MySQL 0 February 10th, 2012 12:12 AM
Cant ADD CONSTRAINT (ergent) melvik MySQL 3 April 18th, 2006 01:16 AM
Access SQL alter table add constraint Skipmeok SQL Language 0 April 27th, 2004 08:02 PM
Alter Table - Add Column liz@trinityholdings.co.za Access 2 July 29th, 2003 03:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.