SQL 不是公认的内置函数名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41218952/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
is not a recognized built-in function name
提问by sai bharath
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
当我试图执行这个时SELECT Split_On_Upper_Case('SaiBharath')
它给出了一个错误“'Split_On_Upper_Case'不是一个公认的内置函数名称。”。有人可以解释一下吗
回答by Mansoor
Add [dbo] in prefix and then execute as same :
在前缀中添加 [dbo] ,然后执行相同的:
SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')
回答by Ravi Matani
To execute function in sql, prefix dbo
should be used.
要在 sql 中执行函数,dbo
应使用前缀。
SELECT [dbo].[Split_On_Upper_Case] ('SaiBharath')
回答by Radu Gheorghiu
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.
此外,一个好的做法是在每个函数或数据库对象前面加上它的模式名称。