Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FK for preventing parental deletions.
Message
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
00720778
Message ID:
00720840
Views:
18
This message has been marked as the solution to the initial question of the thread.
This is one of the functions of a Foreign Key Constraint. It will verify that the FK is not used in the related table before allowing the row to be deleted.


>How would I use a Foreign Key to prevent deletions on the parent table?
>
>For example, I have an Orders table and an OrderCancels table related by a FK on the iOrdID. When the app requests to delete a record on the Orders table, I need to check the OrderCancels table via the iOrdID FK for corresponding records, and if there are, not delete the order.
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform