- #1
- 7,377
- 11,342
- TL;DR Summary
- Trying to figure out syntax problem with Syntax for function that takes as inputs two Real number and outputs the square root of the sum of the squares of the two numbers.
Hi, trying to write a user-defined function in SSMS Sql Server .that takes two Real numbers and outputs the square root of the
sum of their squares:
Line 152
CREATE FUNCTION dbo.Distance(@a Real, @b Real)
RETURNS Real
AS
BEGIN
SQRT(@a * @a + @b * @b)
END ;
GO
I re-checked the syntax for user-defined functions, but somehow I keep getting error messages .
Error Message:
Msg 102, Level 15, State 1, Procedure Distance, Line 5 [Batch Start Line 152]
Incorrect syntax near 'SQRT'.
any ideas?
sum of their squares:
Line 152
CREATE FUNCTION dbo.Distance(@a Real, @b Real)
RETURNS Real
AS
BEGIN
SQRT(@a * @a + @b * @b)
END ;
GO
I re-checked the syntax for user-defined functions, but somehow I keep getting error messages .
Error Message:
Msg 102, Level 15, State 1, Procedure Distance, Line 5 [Batch Start Line 152]
Incorrect syntax near 'SQRT'.
any ideas?