Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Fetch Customers using ZIPCODE and DISTANCE

Author  Topic 

dhinasql
Posting Yak Master

195 Posts

Posted - 2009-01-08 : 02:34:36
Dear Friends,

We have two table named customer and Zip. Please find the sample data below

Customer
MemId | FirstName | LastName | ZipCode
-----------------------------------------
12 Dhina T 92131
14 ABC DEF 92131
15 XYZ K 01001
16 UJI OQS 01009

Zip
ZipId | ZipCode | City | State | Latitude | Longitude
-------------------------------------------------------------
1 92131 HOLTSVILLE NY 40.485500 -73.024000
2 01001 BENJAMI NY 42.317017 -72.515056
3 01009 BONDSVILLE MA 42.124500 -72.204000

This is the sample data for the two tables,

Here what we need to do is i have to pass zipcode and distance as a two arguments, and display the customers who are all in the zip within the distance.

Please help me in this regards.

Thanks in Advance

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-01-08 : 05:26:32
There is an sp to find distnace between 2 sets of latitude and logitudes in this forum. Refer that.
Go to Top of Page
   

- Advertisement -