create table [tblA] ([col_vb] varbinary(8), [col_str] varchar(18))
[col_vb] stores timestamps from another db
[col_str] has to be updated on insert to store a string with hex representation of [col_vb]
I'm using this to get a hex string from varbinary:
So far, I tried the following:
1. Using "instead of insert" trigger to update [col_str]. It works, but I'll have to maintain triggers if anything changes.
2. Making [col_str] a computed column. It works, but 1) there is a performance hit and 2) sys.fn_varbintohexstr actually returns nvarchar(max) -- not what I need.
3. Making [col_str] a persisted computed column. "Create table" blows up, returning the following:
Msg 211, Level 23, State 107, Line 1
Possible schema corruption. Run DBCC CHECKCATALOG.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.