문제

I have a table with two columns {FlatContent, HashedContent}. Now I want to automatically compute the hash value of FlatContent when new row was inserted or an existing row was updated. To date, I've never used from trigger, so I can't do this by trigger or another approach which is exist to solve this issue.

Thanks if anybody can help me ;)

도움이 되었습니까?

해결책

Instead of using a trigger, make HashedContent a persisted computed column in your table definition.

ALTER TABLE YourTable
    ADD HashedContent AS HashBytes('SHA1', FlatContent) PERSISTED
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top