alter table

Use alter table to encrypt or decrypt existing data or to add an encrypted column to a table.

Syntax

Encrypt a column:

alter table tablename add column_name 
            encrypt [with [database.[owner].]keyname

Decrypt an existing column:

[decrypt [with [database.[owner].]keyname]]

keyname – identifies a key created using create encryption key. The creator of the table must have select permission on keyname. If keyname is not supplied, Adaptive Server looks for a default key created using create encryption key or alter encryption key as default.

Example

Example 5

Create an encryption key and encrypt ssn column in existing “employee” table.

alter table employee modify ssn
         encrypt with ssn_key
grant decrypt on employee(ssn) to hr_manager_role,
         hr_director_role

Usage