Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: inserting, updating sql server
08-20-2004, 03:38 PM #1
- Join Date
- Aug 2004
- Thanked 0 Times in 0 Posts
inserting, updating sql server
Not sure if this is the right forum?
I have two tables as below. I want to update a quote and change the item for which it is for. So I want to do an update statement to change the cat_ref that the quote is for. However, when I do this I get a foreign key conflict with cat_ref in the item table. How do I get around this? Thanks
CREATE TABLE Item ( cat_ref VARCHAR(5)PRIMARY KEY, descrip VARCHAR(50), date_added SMALLDATETIME, cat_type VARCHAR(20), CREATE TABLE has_quote ( quote_id INT IDENTITY (1,1) PRIMARY KEY, date_of_quote SMALLDATETIME, cat_ref VARCHAR(5)FOREIGN KEY REFERENCES Item(cat_ref), first_name VARCHAR(10), surname VARCHAR(10), customer_phone VARCHAR(20), FOREIGN KEY (first_name, surname, customer_phone) REFERENCES Customer(first_name, surname, customer_phone) ON DELETE CASCADE ON UPDATE CASCADE)