Power error handling inside of sql function
Posted
by user172062
on Stack Overflow
See other posts from Stack Overflow
or by user172062
Published on 2010-05-21T13:23:35Z
Indexed on
2010/05/21
13:30 UTC
Read the original article
Hit count: 288
sql-server
|sql-server-2005
I have a power function call inside of a sql function. What is the correct way to handle overflow and underflow conditions since I cannot use a Try Catch inside of a function. I am also trying to avoid modifying the ARITHABORT, ANSI_WARNINGS, and ARITHIGNORE settings in the calling code.
GO
CREATE FUNCTION TestPow()
RETURNS DECIMAL(30, 14)
AS
BEGIN
DECLARE @result FLOAT
SET @result = POWER(10.0, 300)
RETURN @result
END
GO
SELECT dbo.TestPow()
© Stack Overflow or respective owner