SQRT() function :
This function in SQL Server is used to return the square root of a specified positive number. For example, if the specified number is 81, this function will return 9.
Features :
- This function is used to find the square root of a given number.
- This function accepts only positive numbers.
- This function also accepts fraction numbers.
- This function always returns positive number.
- This function use the formula " (a)1/2 = Returned value ", where a is the specified number.
SQRT(number)Parameter : This method accepts a parameter as given below :
- number : Specified positive number whose square root is going to be returned.
SELECT SQRT(4);Output :
2.0Example-2 : Getting the square root of the specified number 0.
SELECT SQRT(0);Output :
0.0Example-3 : Using SQRT() function with a variable and getting the square root of the specified number 1.
DECLARE @Parameter_Value INT; SET @Parameter_Value = 1; SELECT SQRT(@Parameter_Value);Output :
1.0Example-4 : Getting the square root of 16 which is the result of "64/4".
SELECT SQRT(64/4);Output :
4.0Example-5 : Using SQRT() function with a variable and getting the square root of float value "4.7".
DECLARE @Parameter_Value FLOAT; SET @Parameter_Value = 4.7; SELECT SQRT(@Parameter_Value);Output :
2.16794833886788Application : This function is used to return the square root of a specified positive number.