My understanding is that it's not possible to set up a temporal table where the base table has a computed column based on a UDF. However, i have seen it suggested that this should be possible if you follow a particular process: Computed Columns In Azure SQL Server 2016 Temporal Tables
The suggested steps are
- First turn off system versioning
- Then add your computed column to the base table
- Verify the "type" of the resulting computed column
- Add the column with the appropriate static type to the history table
- Turn system versioning back on
It could be that this solution only works in Azure. I've tried it out with SQL Standard using a table that has a UDF computed column of type datetime but without success. Has anyone been able to get this to work and if so could you please share an simple TSQL example.
Tnx