my $sth = $dbh->prepare("INSERT into 1985_onwards_slim_I (Year_of_death, Ageyears, Sex, Undcause, OAcode) SELECT Col003, Col020, Col023, Col029, Col051 from 1985_onwards_full_data_set") or die "Couldn't prepare query: ".$dbh->errstr; $sth->execute() or die "Couldn't execute query: ".$sth->errstr;