SQL Server Scalar Value Function instance and reason analysis cannot be called. If MSSQL scalar value function is used, add dbo before the function. Otherwise, the error "not a recognizable built-in function name" is reported.
SQL server Scalar Value Function instance and can not call the Cause Analysis, ms SQL scalar value function, should be added in front of the function \ "dbo. \ ", otherwise the error" not a recognizable built-in function name "will be reported
Cause Analysis of SQL server Scalar Value Function instances and unavailability
-- Scalar Value Function
Set ansi_nulls on
Go
Set quoted_identifier on
Go
-- ===================================================== ======
-- Author:
-- Create date:
-- Description:
-- ===================================================== ======
Create function
(
-- Add the parameters for the function here
<@ Param1, sysname, @ p1>
)
Returns
As
Begin
-- Declare the return variable here
Declare <@ resultvar, sysname, @ result>
-- Add the t-SQL statements to compute the return value here
Select <@ resultvar, sysname, @ result >=< @ param1, sysname, @ p1>
-- Return the result of the function
Return <@ resultvar, sysname, @ result>
End
With the MS SQL scalar function, you should add "dbo." Before the function, otherwise the error "not a recognizable built-in function name" will be reported. For example
Declare @ whichdb tinyint;
Select @ whichdb = user_getwhichdb (1); -- check which one
========================================================== ==========
-- Scalar Value Function
Alter function [dbo]. [user_getwhichdb]
(
@ Userid int = 0
)
Returns tinyint
With execute as caller
As
Begin
Declare @ whichdb tinyint;
Set @ whichdb = 1;
If @ userid> = 115098
Set @ whichdb = 2;
Return (@ whichdb );
End