[英]SQL Server built-in function name
I'm trying to update sum columns data like this: 我正在尝试更新汇总列数据,如下所示:
update
tableName
set
score = myFunction(tableName.id)
In other hands I want to have a table like this: 换句话说,我想要一个这样的表:
column1 | column2
------------------------------
id1 | myFunction(id1)
id2 | myFunction(id2)
id3 | myFunction(id3)
id4 | myFunction(id4)
I defined myFunction
as a scalar-valued functions. 我将
myFunction
定义为标量值函数。 I also tried it as a table-valued function but I see this error in SQL Server 2012: 我也尝试将其作为表值函数使用,但在SQL Server 2012中看到此错误:
Msg 195, Level 15, State 10, Line 14
消息195,第15级,州立10,第14行
'myFunction' is not a recognized built-in function name.“ myFunction”不是公认的内置函数名称。
Please help me 请帮我
Try using the full name of the function, including the database and schema name: 尝试使用函数的全名,包括数据库和架构名称:
update
tableName
set
score = <database>.<schema>.myFunction(tableName.id)
I think only the schema name is needed, but I've gotten in the habit of putting both. 我认为只需要模式名称,但是我已经习惯了把两者都放。
The documentation explains that at least the two part name is needed. 该文档说明至少需要两个部分的名称。 If you don't know what schema are, then the following will probably work:
如果您不知道什么是架构,那么以下方法可能会起作用:
update
tableName
set
score = dbo.myFunction(tableName.id)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.