added new proc to construct sql limit clause