Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update constraint on multiple fields
Message
De
12/12/2007 13:19:52
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Update constraint on multiple fields
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01275199
Message ID:
01275199
Vues:
48
I have a lookup table and I want to make sure that no one can change the foreign keys once the table has been used by other tables. The lookup table does have a status so I need a constraint the will stop people from changing the foreign keys but allow them to change the status to inactive. If I didn't have a status field that must be editable I would just prevent the row from being changed if there were dependents.

pk --primary key
fk_engine -- engine table key
fk_stage -- stage table key
fk_part -- part table key
status -- 1 or 0, needs to be editable


The fk columns already have foreign key constraints what I am trying to prevent is IT staff changing the foreign key to another valid foreign key. Can I do this with a table constraint or do I need to put a check constraint on each column? Also is there an easy way to find out if the PK has been used in other tables or do I have to do a select on the dependent table?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform