January 8, 2010 at 2:19 pm
I am using IIS web server. And using "ADODB.Connection" to interact with the sql 2008 server.
I have a table called "testing" with some records.
Each record has been updated placing a geography point with a latitude and longitude in a geography type field called "coords"
I would like to get an "ADODB.Recordset" that contains all the records who's "coords" are within a certain distance (say a 100 Meters) of another record.
Here is how I've added the lat/longs ;
sql = "UPDATE testing SET [coords] = geography::Point(52.029736, -113.973541, 4326) WHERE id=2"
Is it possible to have a select statement (or 2) return the records? again I'm using a webserver and need it to be able to run from code in IIS, not the SQL server. I have no idea how to "declare @h" from code like the examples all do...
thanks for your time
Drew
January 8, 2010 at 6:19 pm
sql1 = "SELECT coords.Lat, coords.Long FROM testing WHERE id=1"
lat2 = rs(0)
lon2 = rs(1)
sql2 = "SELECT * FROM testing WHERE id <> 1 AND coords.STDistance(geography::Point(" & lat2 & ", " & lon2 & ", 4326)) <=(20 * 1609.344)"
'20 miles or less
January 8, 2010 at 6:53 pm
drew.403 (1/8/2010)
...Is it possible to have a select statement (or 2) return the records? again I'm using a webserver and need it to be able to run from code in IIS, not the SQL server. I have no idea how to "declare @h" from code like the examples all do...
thanks for your time
Drew
Why is it necessary in this scenario to use inline sql statements rather than a stored procedure?
You could call the stored procedure from your app and pass the parameters that you need that way.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply