preparing scripts for selects from DB