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