Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Foreigh Key Constraint problem
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01537095
Message ID:
01537097
Vues:
29
>>Hi,
>>
>>I am running again into the problem with setting up a Foreign Key constraint (very frustrating). Here is the example:
>>
>>Table 1. VENDORS
>> This table has unique field VENDOR_ID
>>
>>Table 2. PRODUCTS
>> This table has field VENDOR_ID. I want to set up constraint as following:
>>
>>
>>ALTER TABLE [dbo].[products]  WITH CHECK ADD  CONSTRAINT [FK_products_vendor] FOREIGN KEY([vendor_id])
>>REFERENCES [dbo].[vendors] ([vendor_id])
>>ON UPDATE CASCADE
>>
>>
>>I get message:
>>
>>
>>Introducing FOREIGN KEY <name> may cause cycles or multiple cascade paths. Specify ON UPDATE NO ACTION
>>
>>
>>But if I specify ON UPDATE NO ACTION what good is this constraint? I don't see a problem of the multiple cascade paths here. What am I missing? How do you get around this issue with SQL Server?
>
>Does vendor or products table already have another constraint with CASCADE enabled?

Yes. But to completely different tables. That is Vendors has a constraint to some table, say VendorCategories and the Products has constraint with Cascade to a table ProductCategories. Why should those other be relevant?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform