Square Root in Microsoft SQL Server ?

I'm trying to run the following ACCESS query on a MS SQL Server box.

SELECT (abs(Sqr((([GRIDN]-43550)^2)+(([GRIDE]-43170)^2)))/100) AS TheDistance, *
FROM Nearest

It's complaining about the Sqr function.  
Does this function exist ?

If not, how can this (Pythagora's) function be written ?

Will grade A for a quick accurate response.
LVL 2
coopaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
nigelrivettConnect With a Mentor Commented:
SELECT (abs(Sqrt((power([GRIDN]-43550),2)+(power([GRIDE]-43170),2)))/100) AS TheDistance, *
FROM Nearest

could use square instead of power.
0
 
nigelrivettCommented:
no
sqrt(number) is t-sql

look in the bol
0
 
coopaAuthor Commented:
Testing now,

Thanks for the quick response.
If it works you win.
0
 
coopaAuthor Commented:

Had to swap SQRT and ABS around, also the POWER function gave errors (^2 works though) but other than that, Perfect answer.

Thanks.
0
 
coopaAuthor Commented:
my mistake, the ^2 does not work and POWER(value,2) does

Rich
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.