下面的代碼, 在兼容性級別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
新聞熱點
疑難解答