diff --git a/model/Database.cs b/model/Database.cs index a991bc39..5d76df79 100644 --- a/model/Database.cs +++ b/model/Database.cs @@ -399,7 +399,7 @@ from INFORMATION_SCHEMA.TABLE_CONSTRAINTS DELETE_RULE, fk.is_disabled from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc - inner join sys.foreign_keys fk on rc.CONSTRAINT_NAME = fk.name"; + inner join sys.foreign_keys fk on rc.CONSTRAINT_NAME = fk.name and rc.CONSTRAINT_SCHEMA = OBJECT_SCHEMA_NAME(fk.parent_object_id)"; using (var dr = cm.ExecuteReader()) { while (dr.Read()) { var fk = FindForeignKey((string) dr["CONSTRAINT_NAME"], (string)dr["TABLE_SCHEMA"]);