SQL Server Error Messages - Msg 195¶
Error Message¶
Server: Msg 195, Level 15, State 10, Line 1
Function Name is not a recognized function name.
Causes:¶
This error is encountered when invoking a scalar-valued user-defined function using just the single-part name of the function and not including the owner.
To illustrate, let’s say you have the following scalar-valued user-defined function:
CREATE FUNCTION [dbo].[ufn_Greatest]
( @pInt1 INT, @pInt2 INT )
RETURNS INT
AS
BEGIN
IF @pInt1 > @pInt2
RETURN @pInt1
RETURN @pInt2
END
GO
Invoking this scalar-valued user-defined function using just the single-part name of ufn_Greatest will generate the error:
SELECT ufn_Greatest ( [FirstTestScore], [SecondTestScore] ) AS [HigherScore]
FROM [dbo].[StudentScores]
Server: Msg 195, Level 15, State 10, Line 1
'ufn_Greatest' is not a recognized function name.
Solution / Work Around:¶
When invoking scalar-valued user-defined functions, always use the two-part name of the function, which is basically calling the function with the owner name as can be seen from the following example:
SELECT [dbo].[ufn_Greatest] ( [FirstTestScore], [SecondTestScore] ) AS [HigherScore]
FROM [dbo].[StudentScores]