Solved

Square Root in Microsoft SQL Server ?

Posted on 2001-06-29
5
1,620 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

785 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