my $sth = $dbh->prepare("SELECT constraint_name FROM information_schema.constraint_column_usage WHERE TABLE_NAME = '$tbl'"); $sth->execute; my $temp = $sth->fetchrow_arrayref; foreach my $rel (@$temp) { next unless ($rel =~ /ID/); print "Relationship: $rel\n"; my $th = $dbh->prepare("ALTER TABLE Data_CentersTEST DROP CONSTRAINT $rel"); $th->execute; }