Integrating SQL statements to query and post to local server