难道不是一个公认的内置函数名吗

时间:2023-01-15 22:19:38

Created a function

创建一个函数

CREATE FUNCTION Split_On_Upper_Case(@Temp VARCHAR(1000))
RETURNS VARCHAR(1000)
AS
BEGIN
DECLARE @KeepValues AS VARCHAR(50)
SET @KeepValues='%[^ ][A-Z]%'
WHILE PATINDEX(@KeepValues COLLATE Latin1_General_Bin,@Temp)>0
SET @Temp=STUFF(@Temp,PATINDEX(@KeepValues COLLATE Latin1_General_Bin,@Temp)+1,0,' ')
RETURN @Temp
END

When iam trying to exexute this SELECT Split_On_Upper_Case('SaiBharath') It gives an error "'Split_On_Upper_Case' is not a recognized built-in function name.".Can someone please explain this

当我试图exexute这个SELECT Split_On_Upper_Case('SaiBharath')时,它给出了一个错误,“Split_On_Upper_Case”不是一个被识别的内置函数名。有人能解释一下吗?

3 个解决方案

#1


11  

Add [dbo] in prefix and then execute as same :

在前缀中添加[dbo],然后执行相同的操作:

SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')

#2


10  

To execute function in sql, prefix dbo should be used.

要执行sql中的函数,应该使用前缀dbo。

SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')

#3


6  

Just to make sure, set the database you created your function on first by using the use clause and then prefix the call of your function with dbo.

为了确保这一点,首先使用use子句设置创建函数的数据库,然后用dbo前缀调用函数。

USE <DatabaseName>

SELECT dbo.Split_On_Upper_Case('camelCase')

Also, a good practice is prefixing each function or database object for that matter, with its schema name.

此外,一个很好的实践是为每个函数或数据库对象加上它的模式名。

#1


11  

Add [dbo] in prefix and then execute as same :

在前缀中添加[dbo],然后执行相同的操作:

SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')

#2


10  

To execute function in sql, prefix dbo should be used.

要执行sql中的函数,应该使用前缀dbo。

SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')

#3


6  

Just to make sure, set the database you created your function on first by using the use clause and then prefix the call of your function with dbo.

为了确保这一点,首先使用use子句设置创建函数的数据库,然后用dbo前缀调用函数。

USE <DatabaseName>

SELECT dbo.Split_On_Upper_Case('camelCase')

Also, a good practice is prefixing each function or database object for that matter, with its schema name.

此外,一个很好的实践是为每个函数或数据库对象加上它的模式名。