Questions tagged [referential-integrity]

Referential integrity is a property of data which requires the value of an attribute/column of a relation table to exist as a value of another attribute/column in another relation table

For referential integrity to hold in a relational database, any field in a table that is declared a foreign key can contain either a null value, or only values from a parent table's primary key or a candidate key. In other words, when a foreign key value is used it must reference a valid, existing primary key in the parent table.

http://en.wikipedia.org/wiki/Referential_integrity

353 questions
0
votes
2 answers

ActiveDirectoryMembershipProvider and referential integrity

In the past, when I implemented my own authentication mechanisms I would have a user table with relationships to other tables in my application's MySQL database. However, now that I'm considering using ActiveDirectoryMembershipProvider, I see no…
0
votes
1 answer

Enforcing referential integrity on among distantly related tables

I have a four tables, which look a bit like this: CREATE TABLE [TableA] ( [ID] INT NOT NULL IDENTITY (1, 1) PRIMARY KEY ) CREATE TABLE [TableB] ( [A_ID] INT NOT NULL FOREIGN KEY REFERENCES [TableA] ([ID]) , [Value] TINYINT…
p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
0
votes
1 answer

Microsoft Access: warning about duplicates when record was created by data macro

The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. This is the error message I receive when I am halfway through keying in data into my subform. My…
matt
  • 2,857
  • 7
  • 33
  • 58
0
votes
3 answers

merging 2 SQL Server databases with unique ID

I have a challenge which involves merging two applications which reside entirely in separate SQL server databases. Each database maintains its own internal database ID's which are sequenced integers in the 5,000,000 range. I am using a tool which…
0
votes
1 answer

Error signing a soap request. Integrity lost

I have generated my class with xjc and wsimport tools. I have an Object with all the attributes and elements I need. I have a SignatureType Object that must contain the sign of the data i will send. My root object looks like…
amartira
  • 11
  • 2
0
votes
1 answer

Mysql innodb reference integrity with an empty tablr

How an empty table can throw a "A foreign key constraint fails"? I have two table: "listini" and "listinoprezzi", the second one has a foreign reference to the first one. However the "listinoprezzi" is empty, and when I try to truncate "listini" I…
Tobia
  • 9,165
  • 28
  • 114
  • 219
0
votes
1 answer

Can't get my Entities to respect Referential Integrity of the Domain

Background: I am parsing an XML file (book signing events information), and then attempting to create database records based on the Parsed data via Entity Framework Code First (with the help of Entity Framework Power Tools Beta 3). After sorting the…
0
votes
2 answers

How to maintain referential integrity with common great-parent table?

Lets say I have a table with "Groups of Questions" GroupID | value --------+------ 42 | How often do you 9071 | Other question ... And, for each group of questions I have "questions" and "possible answers" Group | QuestionID |…
pmg
  • 106,608
  • 13
  • 126
  • 198
0
votes
6 answers

Update: How to implement Foreign Key concept in MySQL when we do not have referential integrity features in MySQL?

My question is regarding referential integrity concept in MySQL Database. Due to some kind of restrictions from our DBA we are not allowed to use referential integrity features of MySQL and so my question is "How can we implement Foreign Key concept…
Rachel
  • 100,387
  • 116
  • 269
  • 365
0
votes
2 answers

Enforce integrity constraint for closed loop foreign key constraints

The problem arises from the following three tables - Tour - Id TourPackage - Id - TourId Traveller - Id - TourId - PackageId The foreign key constraints are in place. However, I also wish to enforce that Traveller's Package must also refer…
0
votes
1 answer

Building Budget Into a Database

I am building a budget into a SQL Server database, in order to keep track of some items via either web app, or desktop app. My question is when keeping a budget over say five years is it better practice to have line items in one table with their…
user1902540
  • 111
  • 2
  • 12
0
votes
2 answers

Referential integrity with multiple one to many associations

I will explain my case with an example. I have the following tables: persons, places, pictures. Both persons and places have many pictures. What is the best way to express this in a database scheme while maintaining referential integrity? I could…
Marten
  • 1,336
  • 10
  • 16
0
votes
1 answer

Referential cycle: ON DELETE CASCADE?

If "predmet" is a FK to "predmeti", and "nositelj" is a FK to "nastavnici", what will happen if I specify ON DELETE CASCADE to both foreign keys and delete one of the entities? Would it produce an error? Edit: I'm using the latest version of…
Tool
  • 12,126
  • 15
  • 70
  • 120
0
votes
1 answer

Referential Integrity Broken

I have a database that somehow got corrupted in the following way: A record in table A has a value in a foreign key column pointing to table B, but no such record exists in B. The db was created in h2 version 1.3.152 and I recovered it with 1.3.170…
pakman
  • 1,676
  • 3
  • 23
  • 41
0
votes
1 answer

Access ODBC not importing referential integrity

I imported using ODBC tables into access from SQL server but the tables lose all PK and FK integrity. My PKs are no longer required when i got to design view in access?
Batman
  • 5,563
  • 18
  • 79
  • 155