What are the repercussions of not checking existing data when adding a foreign key?
- by scottm
I've inherited a database that doesn't exactly strive for data integrity. I am trying to add some foreign keys to change that, but there is data in some tables that doesn't fit the constraints. Most likely, the data won't be used again so I want to know what problems I might face by leaving it there. The other option I see is to move it into some kind of table without referential constraints, just for historical purposes.
So, what are the repercussions of not checking existing data?
If I create a foreign key constraint on a table and don't check existing data, will all new data inserted into the table be enforced?