Using the AES_ENCRYPT_IV function for Data Encryption
The function AES_ENCRYPT_IV accepts as input a string of type VARCHAR. It encrypts the entire string, including the 2-byte prefix that holds the VARCHAR length, and adds an initialization vector (IV) to the resulting cipher.
Use the following calculation to determine how much space the resulting cipher (including the IV) will require: cipher_length = ( (string_length in bytes) / 16 + 2 ) * 20.
Data can be silently lost if the result of the function AES_ENCRYPT_IV is longer than the defined column width.
Last modified date: 01/27/2026