SQL Server 内置函数名 [英] 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)
我将 myFunction
定义为标量值函数.我也尝试将其作为表值函数但我在 SQL Server 2012 中看到此错误:
I defined myFunction
as a scalar-valued functions. I also tried it as a table-valued function
but I see this error in SQL Server 2012:
消息 195,级别 15,状态 10,第 14 行
myFunction"不是可识别的内置函数名称.
Msg 195, Level 15, State 10, Line 14
'myFunction' is not a recognized built-in function name.
请帮帮我
推荐答案
尝试使用函数的全名,包括数据库和模式名称:
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)
这篇关于SQL Server 内置函数名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!