implemented generic sql statement