Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
chamdev
Starting Member
2 Posts |
Posted - 2009-04-10 : 15:37:18
|
Hi all, I'm having some strange issue with my attempts to add a foreign key to a table. I've tried modifying the table in the GUI and script with the same results. Let's say I write:ALTER TABLE THIS_TABLE ADD CONSTRAINT FK_THIS FOREIGN KEY (THIS_ID)REFERENCES THAT_TABLE(THAT_ID) Executing that block of code gives me an error stating that the alter table command conflicts with the constraint I JUST ADDED (FK_THIS in this case) and that the conflict occurred in the table and column I'm attempting to reference (THAT_TABLE.THAT_ID in this case). To me it is like SQL server is trying to tell me that I've added the constraint to the wrong table. I can band-aid it for now by enforcing the relationship in my application, but we all know that is not at all ideal. Help is always appreciated. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
chamdev
Starting Member
2 Posts |
Posted - 2009-04-10 : 15:56:43
|
Thnx for explaining the error in a way that made sense. It's Friday, I'm off in 10 minutes and my brain is dwelling outside my head, so I never would have checked that. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|