Skip to main content
Open

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

Related products:Software Factory
Arjan Sollie
Frank Wijnhout
Michael
Isaak Kroes
Bart Koning
  • Arjan Sollie
    Arjan Sollie
  • Frank Wijnhout
    Frank Wijnhout
  • Michael
    Michael
  • Isaak Kroes
    Isaak Kroes
  • Bart Koning
    Bart Koning

Michael
Sidekick

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.

Did this topic help you find an answer to your question?

4 replies

Michael
Sidekick
Forum|alt.badge.img+2
  • Author
  • Sidekick
  • 15 replies
  • January 28, 2020

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


Frank Wijnhout
Thinkwise blogger

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.

 

 

 


Michael
Sidekick
Forum|alt.badge.img+2
  • Author
  • Sidekick
  • 15 replies
  • January 30, 2020
Frank Wijnhout wrote:

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 ;-)


Frank Wijnhout
Thinkwise blogger

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

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings