Refactoring for paging support on SQL servers.