Scott Schluer
2004-11-16 16:43:31 UTC
I need to perform a search for all zip codes within "x" miles of a given zip
code using Microsoft SQL Server 2000. Ideally, this would be a User Defined
Function that would accept two parameters: an origin zip code and a radius
(as an integer value). I have a table called ZipCodes that, among other
things, contains all USA zip codes along with the corresponding latitiude
and longitude values.
How would I write a function, or where would I find an algorithm that would
return all of the zipcodes within an "x" mile radius? The UDF would be
called from a stored procedure (i.e. SELECT * FROM Properties WHERE
property_zip IN (...list of zip codes returned by UDF here...).
Any ideas?
Thanks!
Scott
code using Microsoft SQL Server 2000. Ideally, this would be a User Defined
Function that would accept two parameters: an origin zip code and a radius
(as an integer value). I have a table called ZipCodes that, among other
things, contains all USA zip codes along with the corresponding latitiude
and longitude values.
How would I write a function, or where would I find an algorithm that would
return all of the zipcodes within an "x" mile radius? The UDF would be
called from a stored procedure (i.e. SELECT * FROM Properties WHERE
property_zip IN (...list of zip codes returned by UDF here...).
Any ideas?
Thanks!
Scott