Back to Blog

SQL Cast

Latitude and Longitude with the Geography Data Type - SQL Training Online

Work with latitude/longitude using SQL Server Geography data type. Learn spatial queries, distance calculations, and mapping with T-SQL.

1 min read

Last updated on

The Geography data type is used in many different SQL Server databases. It contains Latitude, Longitude, and many other properties and functions.

In this video I show you how to extract the latitude and longitude from the Geography data type.

I use the Wide World Importers and the following scripts:

--SQL Geography Data Type

select CityName

,Location.Lat Latitude

,Location.Long Longitude

,cast(location as varchar(max))

from Application.Cities

Link to the a good tutorial on MSSQLTips.com.

See the original Latitude and Longitude in SQL Server video.

About Joey Blue

Joey Blue teaches practical data skills that companies actually use. With 25+ years of experience solving real data problems for Fortune 500 companies, he's helped 152,000+ students learn SQL, Power BI, reporting, and modern analytics—cutting straight to what works.