Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 13th, 2013, 03: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?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 02:16 AM
Access SQL alter table add constraint Skipmeok SQL Language 0 April 27th, 2004 09:02 PM
Alter Table - Add Column liz@trinityholdings.co.za Access 2 July 29th, 2003 04:06 AM



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


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