...

View Full Version : inserting, updating sql server



newbieasper
08-20-2004, 03:38 PM
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)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum