Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is not a recognized built-in function name

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

like image 309
sai bharath Avatar asked Dec 19 '16 08:12

sai bharath


People also ask

Is Avg a built-in function name?

'AVG' is not a recognized built-in function name." when I try to run the below query. How can I rephrase the AVG(DateDiff) line to calculate this for me? Also, what would this be called so I can do some additional learning on the topic? You need to change your closing parenthesis.

What is built-in function in database?

A built-in function is a piece for programming that takes zero or more inputs and returns a value.

Does trim work in SQL Server?

SQL Server TRIM() FunctionThe TRIM() function removes the space character OR other specified characters from the start or end of a string. By default, the TRIM() function removes leading and trailing spaces from a string.


3 Answers

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

SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')
like image 72
Mansoor Avatar answered Oct 07 '22 18:10

Mansoor


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

SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')
like image 25
Ravi Matani Avatar answered Oct 07 '22 17:10

Ravi Matani


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.

like image 9
Radu Gheorghiu Avatar answered Oct 07 '22 16:10

Radu Gheorghiu