Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » User and database security » Data security » Database encryption and decryption » Column and table encryption

 

Encrypting a table

You can create an encrypted table using the CREATE TABLE statement, or encrypt an existing table using the ALTER TABLE statement.

Prerequisites

To use the CREATE TABLE statement, you must have one of the following system privileges:

  • CREATE TABLE
  • CREATE ANY TABLE
  • CREATE ANY OBJECT

To use the ALTER TABLE statement, you must be the owner of the table being altered or have one of the following privileges:

  • ALTER privilege on the table
  • ALTER ANY TABLE
  • ALTER ANY OBJECT

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

Context and remarks

When you encrypt a table, the encryption algorithm and key that were specified at database creation time are used.

 Task
  • You can either create a table with encryption, or encrypt an existing table.

    Option Action
    Create a table with encryption Create a table using the ENCRYPTED clause of the CREATE TABLE statement.
    Encrypt an existing table Encrypt a table with the ENCRYPTED clause of the ALTER TABLE statement.

Results

The table is encrypted.

Example

The following command creates an encrypted table named MyEmployees:

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

The following statements create a table called MyEmployees2 and then encrypt it.

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

 See also