I'm trying to get JSON data from an encrypted column using sql server, but i'm finding out that every JSON related function i try on the column (IS_JSON, JSON_QUERY, JSON_VALUE) returns an error :
Argument data type nvarchar(max) encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = '***', column_encryption_key_database_name = '***') is invalid for argument 1 of isjson function.
If i try to retrieve the data as plain text nothing to worry about, but if i try to select the json data inside it, it throws the error.
This is an example of query that throws the error
select ISJSON(wbmalert.AlertDetailJson)
from wbmalert
Cannot understand why and how to fix it.
1条答案
按热度按时间jljoyd4f1#
You can't do this on the server-side.
The whole point of Always Encrypted is that the server has no idea what is inside the column, and cannot decrypt it. Only the client can do so as it has the encryption key.
When you query the column directly, the client driver understands that it's encrypted and transparently decrypts it.
While using a Secure Enclave could work for some operations, I don't think
ISJSON
is supported. And whether Secure Enclave will be right for your encryption requirements is another question.