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
Create a non-computed column of appropriate datatype. Create an Insert trigger (and an Update trigger if data will change). You can then persist the function output in a column.
ALTER TABLE SomeTable ADD FormattedSSN VARCHAR(11)
GO
CREATE TRIGGER dbo.TR_I_SomeTable ON dbo.SomeTable AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
update s
set s.FormattedSSN = dbo.FormatSSN()
from SomeTable AS s
join inserted i on i.id = s.id
END
GO