Click on the banner to learn about and purchase my database training on Azure

Consuming the Google Maps API to get address or zip code information in SQL Server

Views: 4.120 views
Reading Time: 3 minutes

Hello people,
It's OK?

In the first post of 2016, I decided to bring a legal use of OLE Automation procedures to look up address information through the zip code or return the zip code (and other information) from an address. This I had already shown before in the posts How to query information from a zip code in SQL Server (where I used the viacep.com.br service) and Consuming the Google Maps API using OLE Automation (where it was passed by parameter only the city), but I decided to create a slightly more complete procedure this time and again using the Google Maps API.

If you have not yet enabled OLE Automation procedure support, see how to do this in the post. Enabling OLE Automation via T-SQL on SQL Server

The main idea is that with the same Stored Procedure, it is possible to work both ways (informing street or zip code) and return the data in the same way. I used some input parameter transformations to make sure the search was as accurate as possible and had a little work to handle the return in XML, so it was nice to practice a bit (then I need to post about handling XML in SQL Server .. LOL)

Get to the point.

Example stored procedure calls:
SQL Server - Google Maps API Integration Search Postcode Address

View source

That's it folks!
Any questions ?

sql, sql server, ole automation, google maps api, zip query, zip search, how to query a zip, retrieve return zip address

sql, sql server, ole automation, google maps api, zip query, zip search, how to query a zip, retrieve return zip address