表现
:
下面的代码
,
在兼容性级别
90
的所有用户数据库和
tempdb
库中都能执行
,
但无法在系统数据库中执行
,
执行会收到如下错误
:
Msg 4121, Level 16, State 1, Line 2
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.f_test", or the name is ambiguous.
看来系统数据库中做东西有门槛了
,
不过
,
如果不在计算列中引用函数
,
直接在查询中引用函数是没有问题的
,
所以不知道是否应该算
BUG
CREATE
FUNCTION dbo.f_test(
@value xml
)
RETURNS
int
AS
BEGIN
RETURN @value.value('(//*)[1]', 'int')
END
GO
CREATE
TABLE #(
col1 xml,
col2 as dbo.f_test(col1)
)
GO
DROP
TABLE #
DROP
FUNCTION dbo.f_test