Encrypting tables

To encrypt tables in your database, table encryption must already be enabled in the database.

When you encrypt a table, the table encryption settings that were specified at database creation time, such as simple, AES, FIPS, and so on, are applied to the table.

To encrypt a table at table creation

  • Create a table using the ENCRYPTED clause of the CREATE TABLE statement.

    The following command creates an encrypted table named MyEmployees:

    CREATE TABLE MyEmployees (
     MemberID CHAR(40),
     CardNumber INTEGER )
    ENCRYPTED;

To decrypt a table after it has been created

  • Decrypt a table with the NOT ENCRYPTED clause of the ALTER TABLE statement.

    The following command decrypts the MyEmployees table created in the previous example:

    ALTER TABLE MyEmployees 
    NOT ENCRYPTED;
See also