Add a checkbox to the software factory reference popup to set the reference as No Check

Related products: Software Factory

The option no-check on references is something that we could use when applying a reference on a table that contains historic data from a old-application.

For example you can only migrate the headings of invoices to the new system but no invoice lines. You do want that new invoices created in the system you are creating has a check constraint that is validated. But for old-data you want it not to apply. For this reason SQL implemented the No Check option on references… 

What i would like to see is a checkbox on the reference box where you can set the reference to be as a No Check reference. 

Why do i want this? Well i've seen many projects where people just toggle of the Integrity check on the reference. But do not consider that database could get corrupted when something goes wrong. Fixing missing data is harder dan solving the problem when the check constraint gives an error.

To be clear, i mean the reference popup in the datamodeler


Hey Michael, as far as I know SQL Server is not capable of checking data on referential integrity for new data only. The NOCHECK option in fact kind of disables the constraint for all data. I don't think that is what you want.

What you can do is change your reference into a GUI-reference (check is off) and add some code into your triggers to enforce integrity for new records.

 

 

 


Hey Michael, as far as I know SQL Server is not capable of checking data on referential integrity for new data only. The NOCHECK option in fact kind of disables the constraint for all data. I don't think that is what you want.

What you can do is change your reference into a GUI-reference (check is off) and add some code into your triggers to enforce integrity for new records.

 

WITH CHECK will check existing data against the new constraint.
WITH NOCHECK will not check existing data against the new constraint. This will allow you to have child records without a corresponding parent.

I believe SQL Server is capable ;-)


Michael, I tested it and you are right. SQL Server is capable :)