Remove-SqlColumnEncryptionKey

Removes the column encryption key object from the database.

Syntax

Remove-SqlColumnEncryptionKey
      [-Name] <String>
      [-InputObject] <Database>
      [-Script]
      [<CommonParameters>]
Remove-SqlColumnEncryptionKey
      [-Name] <String>
      [[-Path] <String>]
      [-Script]
      [<CommonParameters>]

Description

The Remove-SqlColumnEncryptionKey cmdlet removes the column encryption key object with the specified name from the database.

Examples

Example 1: Remove a column encryption key by name

PS C:\> CD SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase
PS SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase> Remove-SqlColumnEncryptionKey -Name -Name "CEK1"

This command removes the column encryption key named CEK1 from database MyDatabase on server instance MyServer\MyInstance

Parameters

-InputObject

Specifies the SQL database object, for which this cmdlet runs the operation.

Type:Database
Position:2
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the column encryption key object that this cmdlet removes.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Path

Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, this cmdlet uses the current working location.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Script

Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.SqlServer.Management.Smo.Database