Create foreign key without checking existing data


This is a 2 part question.

<strong>Question 1:</strong> I am trying to create a foreign key on a table where I need to turn off the "Check Existing Data on Creation or Re-Enabling". I know theres an option visually but I'm looking for a way to do it programmatically. Is there anyway to do this?

<strong>Question 2:</strong> I have a code table and two tables A and B that need to reference that code table. I want to have these both referenced from a relationship table but I want to able to use the same column. Can I have 2 foreign keys pointing to the same column?


Yes you can have the same column inthe parent table refer to differnt columns in multiple tables.

I do not recommend turning off checking FK on creation. If you have bad data now, you need to fix it now. Otherwise the first time someone edits one of those records it will fail the FK check then.

From Books online as to why it is a bad idea to use nocheck:


If you do not want to verify new CHECK or FOREIGN KEY constraints against existing data, use WITH NOCHECK. We do not recommend doing this, except in rare cases. The new constraint will be evaluated in all later data updates. Any constraint violations that are suppressed by WITH NOCHECK when the constraint is added may cause future updates to fail if they update rows with data that does not comply with the constraint.



  • How should I fit a shape into a space?
  • flink org.apache.flink.table.api.NoMatchingTableFactoryException
  • iOS and Infrared
  • training UBM with sidekit from custom data
  • MATLAB: MEX matrix division gives different result than m-file
  • Libspotify playing problems
  • How to Get DB Field name from ConstraintViolationException - Hibernamte
  • Passing variable to WinBugs model in R
  • Accessing the real file name of a symbolic linked file
  • C function pointer type compatibility
  • Multiple Layouts Previews for Android in Eclipse
  • How to determine the association between a VB6 app and an exe instanced with CreateObject()
  • How to specify a multi-column UNIQUE constraint in code-first Entity Framework fluent API
  • Detaching entity along with referenced entities
  • How do I know what reference to include to import a specific .NET namespace?
  • NetBeans doesn't see style.css [duplicate]
  • Google Player Game Service Error: Can't build the sample game
  • How to best manage SMTP clients
  • Swift iOS don't recognize GCM library imports?
  • CoreData basics – to-many relationship array data
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • Azure table store snapshot/backup capability
  • Bigquery event streaming and table creation
  • GAE: Way to get reference to an HttpSession from its ID?
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • What is the purpose of TaskExecutor in spring?
  • How to revert to previous XCode version?
  • Array with custom indexes in Ionic2
  • Groovy: Unexpected token “:”
  • Declaring variable dynamically in VB.net
  • Replace value with Factor in r data.table
  • How to access EntityManager inside Entity class in EJB3
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Linq Objects Group By & Sum
  • Exchange data b/w iOS devices using Bluetooth 4.0
  • Check if a string to interpolate provides expected placeholders
  • Javascript + PHP Encryption with pidCrypt
  • Large data - storage and query
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Error creating VM instance in Google Compute Engine