Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update constraint on multiple fields
Message
From
12/12/2007 13:19:52
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Update constraint on multiple fields
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01275199
Message ID:
01275199
Views:
47
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
Map
View

Click here to load this message in the networking platform