SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Zip Code Function in SQL Server
-
Mar 25, 2004, 11:03 #1
- Join Date
- Mar 2000
- Location
- Muskegon, MI
- Posts
- 2,328
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Zip Code Function in SQL Server
This post relates to this one on zip code proximity - http://www.sitepoint.com/forums/showthread.php?t=157759
I was able to get this working correctly so that a user can plug in a zip code and a radius and see all the zip codes that fall in the radius. But what I would love to have is a custom function that when I run the query I also get the distance between the zip code I am looking up and the ones it returns.
Code:Select Zipcode, ZipDistance('49415') as Distance From Zipcodes Where Latitude = 'somenumber' And Longitude = 'somenumber' Order By Distance
-
Mar 26, 2004, 21:09 #2
- Join Date
- Jan 2002
- Location
- London
- Posts
- 3,509
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Since each ZIP has a longitude and latitude, surely what you're really asking is how to calculate the distance between two points on the surface of a spheroid?
MarcusJT
- former ASP web developer / former SPF "ASP Guru"
- *very* old blog with some useful ASP code
- Please think, Google, and search these forums before posting!
-
Mar 27, 2004, 12:07 #3
- Join Date
- May 2002
- Location
- Jacksonville, FL
- Posts
- 1,168
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
And that's not difficult at all...
-
May 6, 2004, 18:29 #4
- Join Date
- Aug 2002
- Location
- Boise, Idaho
- Posts
- 411
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I was wondering, Westmich, how did you get your list of zip codes with lattitude / longitude coordanants? I have been looking for them, but have been unable to find anything.
Thanks,
Chris S.Chris S.
Free Web Scripts - Form generators, AJAX tools and more!
Micro CMS - A totally free AJAX-based, SEO-ed CMS!
Bookmarks