Information générale
Forum:
Microsoft SQL Server
Titre:
Update constraint on multiple fields
Versions des environnements
SQL Server:
SQL Server 2000
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement