CREATE TABLE ... ENCRYPTED WITH (Always Encrypted)
values are encrypted by the client driver; the server sees ciphertext
What changes
- Input
- column definition and a column encryption key
- Output or change
- client-side encrypted column
Syntax at a glance
column_name datatype ENCRYPTED WITH ( COLUMN_ENCRYPTION_KEY = key_name , ENCRYPTION_TYPE = { DETERMINISTIC | RANDOMIZED } , ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256' )
Work example
An Always Encrypted column must use an approved encryption type and key.
Review key metadata, deterministic or randomized mode, driver support, and query limitations with the data owner.
Check your work A lab client encrypts and decrypts a synthetic value using the intended column key.
Open Microsoft Learn for full syntax, permissions, and details for your version.