2

我想将现有表转换为临时表,它有 2 个计算列(用户定义函数)。

我已经使用下面的脚本将 3 列添加到我的表中,并且成功。

Alter Table Trips
Add StartTime DateTime2 (2) GENERATED ALWAYS AS ROW START HIDDEN
        constraint df_StartTime default DateAdd(second, -1, SYSUTCDATETIME()),
    EndTime DateTime2 (2) GENERATED ALWAYS AS ROW END HIDDEN
        constraint df_EndTime default '9999.12.31 23:59:59.99',
    Period For System_Time (StartTime, EndTime)
Go

但是当我试图执行下面的脚本时

Alter Table Trips
    SET(SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.Trips_History))
Go

我收到以下错误

Msg 13585, Level 16, State 1, Line 19
Computed column is defined with a user-defined function which is not allowed with system-versioned table 'AccessBetaX.dbo.Trips' because it performs user or system data access, or is assumed to perform this access. A function is assumed by default to perform data access if it is not schemabound.

我错过了什么重要的事情吗?

4

0 回答 0