Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Foreign Key Constraint with No Check
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01554296
Message ID:
01554300
Views:
37
>Hi,
>
>I would like understand possibly side effects of applying a foreign key constraint with No Check. Here is why I am thinking of using FK constraint with No Check:
>
>I have to convert a customer database from VFP to SQL Server database. The VFP database has some entries (I don't know how much but I presume a good number) that are "orphaned." That is, if I do conversion with FK constraint in place I will get many records skipped that will not pass. So my strategy is to remove all FK constraints, convert the data from VFP to SQL and then add FK constraints with No Check. Therefore, if I understand correctly, the FK constrains will not be enforced on all existing records but only to the new records.
>
>So before I follow with this approach, I would like to know if there any negative ramifications from this approach.
>
>TIA for any suggestions.

If you add constraints with NO Check, they will not be enforced for new rows either. E.g. you still will be able to insert orphans and other garbage. We actually have a lot of constraints with NO CHECK because we like to have default 0 value (or empty) instead of NULL when there is no relations. The down side is that you're not protected anymore.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform