Top "Foreign-keys" questions

Foreign keys are a data integrity feature of relational (and SQL) databases.

Cannot truncate table because it is being referenced by a FOREIGN KEY constraint?

Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the …

sql-server sql-server-2005 tsql truncate foreign-keys
Add Foreign Key to existing table

I want to add a Foreign Key to a table called "katalog". ALTER TABLE katalog ADD CONSTRAINT `fk_katalog_sprache` …

mysql foreign-keys
INSERT statement conflicted with the FOREIGN KEY constraint - SQL Server

I am getting the following error. Could you please help me? Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with …

sql sql-server sql-server-2005 foreign-keys
How can foreign key constraints be temporarily disabled using T-SQL?

Are disabling and enabling foreign key constraints supported in SQL Server? Or is my only option to drop and then …

sql-server tsql foreign-keys constraints
How to truncate a foreign key constrained table?

Why doesn't a TRUNCATE on mygroup work? Even though I have ON DELETE CASCADE SET I get: ERROR 1701 (42000): Cannot truncate …

mysql foreign-keys constraints truncate dml
MySQL Error 1215: Cannot add foreign key constraint

I am trying to forward engineer my new schema onto my db server, but I can't figure out why I …

mysql foreign-keys
MySQL Cannot Add Foreign Key Constraint

So I'm trying to add Foreign Key constraints to my database as a project requirement and it worked the first …

mysql sql foreign-keys
Mysql error 1452 - Cannot add or update a child row: a foreign key constraint fails

I'm having a bit of a strange problem. I'm trying to add a foreign key to one table that references …

mysql foreign-keys mysql-error-1452
How do I see all foreign keys to a table or column?

In MySQL, how do I get a list of all foreign key constraints pointing to a particular table? a particular …

mysql foreign-keys innodb
How to select rows with no matching entry in another table?

I'm doing some maintenance work on a database application and I've discovered that, joy of joys, even though values from …

sql foreign-keys