I have a custom function, and I am trying to created a persisted column using this function.
It is giving me following error.
Computed column
Instead of calling the UDF, Set the computed column expression to
Case When Len(EmployeeSSN) = 0 Then
SUBSTRING(EmployeeSSN, 1, 3) + '-' +
SUBSTRING(EmployeeSSN, 4, 2) + '-' +
SUBSTRING(EmployeeSSN, 6, 4)
Else EmployeeSSN End
In the Create Table script you can add a column:
[NewColumnName] As
(Case When len([UpdateUserId])=(0) T
Then (((substring([UpdateUserId],(1),(3))+'-')+
substring([UpdateUserId],(4),(2)))+'-')+
substring([UpdateUserId],(6),(4))
Else [UpdateUserId] End) PERSISTED,