General information
Forum:
Microsoft SQL Server
Title:
Update constraint on multiple fields
Environment versions
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?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only