Jun 19, 2017 02:40 AM|EvenMa|LINK
According to your SQL statement which you provide, might the error was occurred by the following statements:
UPDATE MedicalRecordSConsent SET DateofBirth = ENCRYPTBYKEY(KEY_GUID('SymKeyChain'),@DateofBirth )
The type of [DateofBirth] is DateTime, the return type of ENCRYPTBYKEY(KEY_GUID('SymKeyChain'),@DateofBirth ) is nvarchar, and the format between them didn’t match, so that’s occurred the error.
In your case, you wanted to store the encrypt data, I suggest you could change the type of [DateofBirth] to nvarchar(256)
If you have any other questions, please feel free to contact me any time.