A data analyst is designing a new fact table in Microsoft SQL Server to store the latitude-longitude coordinates of every retail branch. The business will run queries such as
SELECT TOP (5) BranchID
FROM dbo.Branch
WHERE @customerLocation.STDistance(Location) <= 10000; -- 10 km
to find the five closest branches to a customer anywhere in the world. The analyst needs the chosen column data type to perform built-in, accurate distance calculations that account for the curvature of the Earth without requiring custom formulas. Which SQL Server data type best meets these requirements?
The geography data type is designed for round-earth (ellipsoidal) coordinate systems. SQL Server implements methods such as STDistance, STBuffer and STIntersects that return geodesic results when the column is geography, so the distance between two latitude-longitude points is calculated along the Earth's surface. The geometry type, by contrast, assumes a flat (Euclidean) plane; its distance calculations become inaccurate over large areas and do not automatically use great-circle math. Storing coordinates in varchar or varbinary columns would prevent the database engine from using any spatial methods at all, leaving all calculations to the application layer. Therefore, choosing geography ensures accurate, built-in spatial querying for global distances, while the other options either yield planar errors or lack spatial awareness entirely.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the difference between the geography and geometry data types in SQL Server?
Open an interactive chat with Bash
How does the STDistance method work with the geography data type?
Open an interactive chat with Bash
Why is using a varchar or varbinary column problematic for storing spatial data in SQL Server?
Open an interactive chat with Bash
CompTIA Data+ DA0-002 (V2)
Data Concepts and Environments
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .