SQL Server to Access2000

I

Irishmaninusa

Hi Everyone
I have this query in SQL SERVER that I am trying to convert to Access SQL


SELECT @latitude,@longitude

Select
ZipCode,

Avg(3958.75 * ACos(Sin(@Latitude/57.2958) *
Sin(Latitude/57.2958) +
Cos(@Latitude/57.2958) *
Cos(Latitude/57.2958) *
Cos(Longitude/57.2958 - @Longitude/57.2958))) As Miles
From
tblZipCodes
Where
Longitude Is Not Null
And Latitude Is Not Null
And @miles >=
(
3958.75 * ACos(Sin(@Latitude/57.2958) *
Sin(Latitude/57.2958) +
Cos(@Latitude/57.2958) *
Cos(Latitude/57.2958) *
Cos(Longitude/57.2958 - @Longitude/57.2958))
)
And ZipCode != @ZipCode
Group by zipCode
Order by miles


I am not too worried about the variables with @ in front of them.....what I
am looking for is a function that does the same thing as ACos function does
in Sql SERVER for ACCESS.....I have converted this query
to Access, and in sql server if I leave the ACOs function I get 2
records....but since the function doesn't exist in Access, and I use the Cos
function....I don't get any records.
http://msdn.microsoft.com/library/en-us/tsqlref/ts_aa-az_5a5v.asp?frame=true
explains what the ACos function does....thanks in advance.


JohnD
 
V

Victor Delgadillo

You can derive the ArcCos function using the following alternative:
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
see the Access VBA Help on Derived Math Functions.

--
Victor Delgadillo [MVP Access]
Miami, Florida

Consultas al grupo, asi todos nos beneficiamos.

_
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top