Solved

Square Root in Microsoft SQL Server ?

Posted on 2001-06-29
5
1,623 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:coopa
  • 3
  • 2
5 Comments
 
LVL 18

Expert Comment

by:nigelrivett
ID: 6237574
no
sqrt(number) is t-sql

look in the bol
0
 
LVL 18

Accepted Solution

by:
nigelrivett earned 100 total points
ID: 6237579
SELECT (abs(Sqrt((power([GRIDN]-43550),2)+(power([GRIDE]-43170),2)))/100) AS TheDistance, *
FROM Nearest

could use square instead of power.
0
 
LVL 2

Author Comment

by:coopa
ID: 6237586
Testing now,

Thanks for the quick response.
If it works you win.
0
 
LVL 2

Author Comment

by:coopa
ID: 6237620

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

Thanks.
0
 
LVL 2

Author Comment

by:coopa
ID: 6237669
my mistake, the ^2 does not work and POWER(value,2) does

Rich
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question