Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Set-DbaExtendedProperty on GitHub.
Want to see the Bill Of Health for this command? Check out Set-DbaExtendedProperty.
Updates the value of existing extended properties on SQL Server database objects
Updates the value of existing extended properties on SQL Server database objects. Extended properties store custom metadata like application versions, documentation, or business rules directly with database objects. This function modifies the values of properties that already exist, making it useful for maintaining application version numbers, updating documentation, or batch-modifying metadata across multiple objects.
Works with extended properties on all SQL Server object types including databases, tables, views, stored procedures, functions, columns, indexes, schemas, and many others. The function accepts extended property objects from Get-DbaExtendedProperty through the pipeline, so you can easily filter and update specific properties across your environment.
Set-DbaExtendedProperty
[-InputObject] <ExtendedProperty[]>
[-Value] <String>
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Get-DbaDatabase -SqlInstance localhost -Database mydb | Get-DbaExtendedProperty -Name appversion | Set-DbaExtendedProperty -Value "1.1.0"
Sets the value of appversion to 1.1.0 on the mydb database
PS C:\> Get-DbaDbTable -SqlInstance localhost -Database mydb -Table mytable | Get-DbaExtendedProperty -Name appversion | Set-DbaExtendedProperty -Value "1.1.0"
Sets the value of appversion to 1.1.0 on the mytable table of the mydb database
Accepts extended property objects from Get-DbaExtendedProperty to update their values. Use this to pipeline specific extended properties that you want to modify.
Typically used after filtering extended properties by name, object type, or other criteria to batch update property values across multiple database objects.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Specifies the new value to assign to the extended property. Accepts any string value including version numbers, descriptions, or configuration data.
Common uses include updating application version numbers, modifying documentation text, or changing configuration values stored as extended properties.
Alias | |
Required | True |
Pipeline | false |
Default Value |
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.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |