Fix run of database script for all queries