views:

130

answers:

1

Hi all.

I need help with this. I am looking for a complete TSQL code. (no c++/C#)

  1. define 32 points around a central point forming a quasi circle with a given radius in miles.

  2. Check the 32 above points against a given point to see if it is included inside the geo-fence.

Thanks JJ

A: 

You should look into using SQL Server 2008's spatial types, specifically geometry. To do what you're asking, you would do the following:

  1. Create a point using STGeomFromText.
  2. Buffer your point using STBuffer() to create a circle.
  3. Use STIntersects() to determine if other points are within your circle.
Swingley