is not a recognized built-in function name

时光总嘲笑我的痴心妄想 提交于 2019-12-22 01:24:48

问题


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


回答1:


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

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



回答2:


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

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



回答3:


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 <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.



来源:https://stackoverflow.com/questions/41218952/is-not-a-recognized-built-in-function-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!