Adds an extended property for a schema, table, view or column.
Add-ExtendedProperty [-Name] <String> [-Value] <Object> [-SchemaName <String>] -ViewName <String> -ColumnName <String> [<CommonParameters>]
Add-ExtendedProperty [-Name] <String> [-Value] <Object> [-SchemaName <String>] -ViewName <String> [<CommonParameters>]
Add-ExtendedProperty [-Name] <String> [-Value] <Object> [-SchemaName <String>] -TableName <String> -ColumnName <String> [<CommonParameters>]
Add-ExtendedProperty [-Name] <String> [-Value] <Object> [-SchemaName <String>] -TableName <String> [<CommonParameters>]
Add-ExtendedProperty [-Name] <String> [-Value] <Object> [-SchemaName <String>] [<CommonParameters>]
SQL Server has a special stored procedure for adding extended property metatdata about an object. Unfortunately, it has a really clunky interface. This function is an attempt to wrap sp_addextendedproperty
with a saner interface.
Currently, this function only supports adding properties for schemas, tables, and columns. Submit a patch!
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Name | String | The name of the extended property to add. |
true | false | |
Value | Object | The value of the extended property. |
true | false | |
SchemaName | String | The schema of the object. |
false | false | dbo |
TableName | String | The table name. |
true | false | |
ViewName | String | The table name. |
true | false | |
ColumnName | String | The column name. |
true | false |
Add-ExtendedProperty -Name 'Deploy' -Value 'TRUE' -SchemaName 'spike'
Adds custom Deploy
metadata for the spike
schema.
Add-ExtendedProperty -Name 'Deploy' -Value 'TRUE' -TableName 'Food'
Adds custom Deploy
metadata on the Food
table in the dbo
schema.
Add-ExtendedProperty -Name 'IsEncrypted' -Value 'FALSE' -TableName 'User' -ColumnName 'Password'
Adds custom IsEncrypted
metadata on the User
table's Password
column.
Add-ExtendedProperty -Name 'ContainsPII' -Value 'FALSE' -View 'LoggedInUsers'
Demonstrates how to add custom metadata on the LoggedInUsers
view
Add-ExtendedProperty -Name 'IsEncrypted' -Value 'FALSE' -View 'LoggedInUsers' -ColumnName 'Password'
Demonstrates how to add custom metadata for a view's column