【问题标题】:SQL Server : Always Encrypted (Datatype clash error whe trying to insert value in an encrypted column)SQL Server:始终加密(尝试在加密列中插入值时出现数据类型类错误)
【发布时间】:2019-12-19 02:15:46
【问题描述】:

我创建了一个包含两列 (id, name) 的表。使用AlwaysEncrypted 加密id 列,但现在当我尝试在id 列中输入值时,它会抛出此错误:

操作数类型冲突:int 与使用 (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') 加密的 int 不兼容

我能做什么?

【问题讨论】:

标签: sql-server encryption always-encrypted


【解决方案1】:

从错误消息中可以看出,当它期望加密值时,它似乎正在尝试将明文插入列中。

确保在该列中的 INSERT 包含参数(不是明文),并且客户端连接字符串包含“Column Encryption Setting=enabled”。如果您使用 SSMS,请确保在您的查询选项中启用“始终加密的参数化”,并且变量声明和值分配在同一行执行。有关详细信息,请参阅下面的链接。

https://techcommunity.microsoft.com/t5/azure-sql-database/parameterization-for-always-encrypted-using-ssms-to-insert-into/ba-p/386124

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-04
    • 2023-03-23
    • 1970-01-01
    • 2022-09-27
    相关资源
    最近更新 更多