I have created a table with two columns (id, name)
. Encrypted id
column using AlwaysEncrypted
but now when I am trying to enter a value in id
column its throwing this error:
Operand type clash: int is incompatible with int encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'CEK_Auto1', column_encryption_key_database_name = 'TEST_PS')
What can I do?
From the error msg, it looks like it is trying to insert clear-text into column when it is expecting an encrypted value.
Make sure the INSERT into that column contains a parameter (not clear-text) and the client connection string includes "Column Encryption Setting=enabled". If you are using SSMS make sure "Parameterization for Always Encrypted" is enabled in your Query Options, and variable declaration and value assignment are performed on the same line. See link below for more info.