Remove-DbaDbDataClassification
View SourceSynopsis
Removes data classification labels from SQL Server table columns
Description
Removes all data classification metadata from table columns by dropping the four extended properties:
- sys_information_type_id
- sys_information_type_name
- sys_sensitivity_label_id
- sys_sensitivity_label_name
Accepts piped input from Get-DbaDbDataClassification, making it easy to remove classifications
from specific columns or bulk-remove classifications across databases.
Requires SQL Server 2005 or later due to use of sp_dropextendedproperty.
Syntax
Remove-DbaDbDataClassification
[-InputObject] <PSObject[]>
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Examples
Example: 1
PS C:\> Get-DbaDbDataClassification -SqlInstance sql2019 -Database AdventureWorks | Remove-DbaDbDataClassification
Removes all data classifications from the AdventureWorks database.
Example: 2
PS C:\> Get-DbaDbDataClassification -SqlInstance sql2019 -Database AdventureWorks -Table Customer | Remove-DbaDbDataClassification -Confirm:$false
Removes data classifications from all classified columns in the Customer table without prompting.
Example: 3
PS C:\> Get-DbaDbDataClassification -SqlInstance sql2019 -Database AdventureWorks | Where-Object SensitivityLabel -eq "General" | Remove-DbaDbDataClassification
Removes only classifications with the “General” sensitivity label from AdventureWorks.
Required Parameters
-InputObject
Accepts classification objects piped from Get-DbaDbDataClassification.
| Property | Value |
|---|---|
| Alias | |
| Required | True |
| Pipeline | true (ByValue) |
| Default Value |
Optional Parameters
-EnableException
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | false |
| Default Value | False |
-WhatIf
Shows what would happen if the command were to run. No actions are actually performed.
| Property | Value |
|---|---|
| Alias | wi |
| Required | False |
| Pipeline | false |
| Default Value |
-Confirm
Prompts you for confirmation before executing any changing operations within the command.
| Property | Value |
|---|---|
| Alias | cf |
| Required | False |
| Pipeline | false |
| Default Value |
Outputs
PSCustomObject
Returns one object per successfully processed column with these properties:
- ComputerName: The computer name of the SQL Server instance
- InstanceName: The SQL Server instance name
- SqlInstance: The full SQL Server instance name
- Database: The database name
- Schema: The schema of the table
- Table: The table name
- Column: The column name
- Status: The result of the removal operation
dbatools