Skip to content
Advertisement

SQL Server 2016 TDE Encryption on big text column

We implemented SQL TDE (SQL 2016) successfully on columns smaller in text size, but will give error on large columns

Table Structure

“ERROR: “String or binary data would be truncated. The statement has been terminated”.

Advertisement

Answer

Your question is not related to TDE. TDE is a low-level storage encryption option that encrypts data at rest (i.e. in database files) transparently without application code changes.

The ENCRYPTBYKEY T-SQL function encrypts data programmatically. This function returns a varbinary(8000) result. You will get a truncation error when the encrypted value exceeds 8000 bytes so this cannot be used to encrypt large values.

If your goal is to protect data at rest, TDE is the easiest to implement as no code changes are required. Data can be further protected over the wire with TLS encryption.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement