Column Master Keys

A column master key (CMK) is used to encrypt the column encryption key.

In Database Explorer, you can perform operations on column master key by using the shortcut menu. Right-click a column master key to access options such as generating a script or viewing its properties.

View the shortcut menu options of Column Master Keys

Create a column master key

You can create a column master key in SQL Editor by using one of these features:

  • Code completion to write a script.
  • SQL snippets to insert predefined or custom code.

Tip

You can use column-level encryption to encrypt specific columns. For more information, see Encrypt specific columns with column-level encryption.

Generate a script for a column master key

1. In Database Explorer, right-click a column master key and select Generate Script As, then select the statement type.

2. Select an output option:

  • To New SQL Window – Opens the script in a new SQL document.
  • To File – Saves the script to a .sql file.
  • To Clipboard – Copies the script to the clipboard.

View column master key properties

In Database Explorer, right-click the column master key or Column Master Keys node and select Show Details.

Object Viewer opens, displaying detailed information about the column master key.

Refresh the column master key

In Database Explorer, right-click the column master key or Column Master Keys node and select Refresh, or press F5.

Open the Properties pane

In Database Explorer, right-click the column master key and select Properties, or press F4.

Filter column master keys

1. In Database Explorer, right-click the Column Master Keys node and select Filter.

2. In the Filter Settings dialog, configure the filter parameters.

3. Click OK to apply the filter.

Note

When you expand the Column Master Keys node, the number of objects it contains appears in parentheses next to the node name. This number changes depending on the applied filter settings.

Delete a column master key

1. In Database Explorer, right-click the column master key you want to delete and select Delete, or press Delete.

2. Click Yes to confirm the deletion.

Note

You cannot undo the drop operation, as this action permanently deletes the column master key. To avoid data loss, back up the database before deleting it.

Shortcut menu options for a column master key

The following table describes the shortcut menu options available for a column master key in Database Explorer.

Name Description
Generate Script As Generates a script for the selected object using the CREATE, DROP, and DROP and CREATE statements. The script can be generated to a new SQL document or to a .sql file, or copied to the clipboard.
Show Details Opens Object Viewer that displays object details.
Delete Drops the selected object from the database.
Shortcut: Delete
Refresh Updates the object list to reflect the latest changes.
Shortcut: F5
Properties Opens the Properties pane that displays the object information.
Shortcut: F4

Shortcut menu options for the Column Master Keys node

The following table describes the shortcut menu options available for the Column Master Keys node in Database Explorer.

Name Description
Filter Opens the Filter Settings dialog to control which CMK should appear in Database Explorer.
Show Details Opens Object Viewer that displays object details.
Refresh Updates the object list to reflect the latest changes.
Shortcut: F5

Bulk operations

In Database Explorer, hold down Ctrl and select multiple column master keys. Then right-click the selection and select the required option.

The following table describes the shortcut menu options available for column master keys.

Name Description
Generate Script As Generates a script for the selected objects using the CREATE, DROP, and DROP and CREATE statements. The script can be generated to a new SQL document or to a file, or copied to the clipboard.
Delete Drops the selected column master keys from the database.
Shortcut: Delete

Bulk operations for multiple column master keys