SQRT returns a value of data type NUMERIC, unless numeric-expression is data type DOUBLE, in which case the returned data type is DOUBLE. The returned value has a precision of 36 and a scale of 18.
SQRT can be specified as a regular scalar function or as an ODBC scalar function (with the curly brace syntax).
Examples
The following example shows the two SQRT syntax forms. Both return the square root of 49:
SELECTSQRT(49)ASSRoot,{fnSQRT(49)}ASODBCSRoot
The following embedded SQL example returns the square roots of the integers 0 through 10:
SETa=0WHILEa<11{&sql(SELECTSQRT(:a)INTO:b)IFSQLCODE'=0{WRITE!,"Error code ",SQLCODEQUIT}ELSE{WRITE!,"The square root of ",a," = ",bSETa=a+1}}