Function can call other Function | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Function can call other Function

Hello All,
Can I call a udf_Function into another udf_Function. If so, plz provide one example to me. Thanku Aruna Mathew

CREATE FUNCTION dbo.hypsin (@sinhyp FLOAT)
RETURNS FLOAT
AS
BEGIN
RETURN (POWER(EXP(1),@sinhyp) – POWER(EXP(1),[email protected]) )/2
END
GO
CREATE FUNCTION dbo.hypcos (@coshyp FLOAT)
RETURNS FLOAT
AS
BEGIN
RETURN ( POWER(EXP(1),@coshyp) + POWER(EXP(1),[email protected]) )/2
END
GO
CREATE FUNCTION dbo.hyptan (@tanhyp FLOAT)
RETURNS FLOAT
AS
BEGIN
RETURN (dbo.hypsin(@tanhyp)/dbo.hypcos(@tanhyp))
END
GO
SELECT dbo.hyptan(0.5)
DROP FUNCTION dbo.hypsin
DROP FUNCTION dbo.hypcos
DROP FUNCTION dbo.hyptan


Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)
Just make sure you’re not handling query criteria through a UDF that calls another UDF – you will get terrible response times. Nine times out of ten, you can do the same in a straight WHERE clause.
]]>