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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Update Query help

Author  Topic 

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2004-10-29 : 11:32:20
I'm trying to update a table with a user id, but i'm getting an update statement conflicted with column foreign key constraint. How would I go about changing it within two tables?

There's a table called Employee and Customers. The Customer table has the employee id. I want to be able to go and change the Customers table, where the employee reside to a different employee's id.

Here's what I got so far.

UPDATE Customers
SET Emp_ID = 'Joe'
WHERE Emp_ID = 'Mary'

Thanks in advance.

Kristen
Test

22859 Posts

Posted - 2004-10-29 : 12:01:12
You can't. You'll have to insert a new "parent" record with the new key, change the child, then delete the old parent record. Its a swine ...

Kristen
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-01 : 22:48:26
if you have update cascade on, you can.

--------------------
keeping it simple...
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-11-02 : 00:34:56
So you can! Provided you can, of course ... we always seem to have too many other relationships such that the one where we really REALLY want that is disallowed :-(

Kristen
Go to Top of Page
   

- Advertisement -