I have table with latitude,longitude and postcodes. I want select the records which are near by given postcode and radius in miles. e.g user will give inputs postcode = 'NW44JL' and radius = 1 mile. I need to get all the records from the table with in 1 mile radius of postcode 'NW44JL'. Can anyone help me to get this. Thanks
For this you'll want to use the built in SPATIAL
datatypes:
MSDN (Designing and Implementing Spatial Storage (Database Engine))
Try the following tutorials to get you started, written by the user @SQLMenace:
SQL Server Zipcode Latitude/Longitude proximity distance search
and
SQL Server 2008 Proximity Search With The Geography Data Type
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With