Skip to content

Repair DatabaseConstraintNames

github-actions edited this page Jul 30, 2026 · 1 revision

external help file: Databaseline-help.xml Module Name: Databaseline online version: schema: 2.0.0

Repair-DatabaseConstraintNames

SYNOPSIS

Finds database constraints with system-generated names and gives them deterministic names.

SYNTAX

Repair-DatabaseConstraintNames [-SqlInstance] <DbaInstanceParameter> [-Database] <String> [-Update]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

EXAMPLE 1

Repair-DatabaseConstraintNames SqlServerName DatabaseName -Update

WARNING: Renamed 10 defaults

PARAMETERS

-SqlInstance

The server to use, by name or constructed via Connect-DbaInstance.

Type: DbaInstanceParameter
Parameter Sets: (All)
Aliases: Parent, ServerInstance

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Database

The the database to connect to on the server.

Type: String
Parameter Sets: (All)
Aliases: Name

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

-Update

Update the database when present, otherwise simply outputs the changes as script.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES

RELATED LINKS

Use-SqlcmdParams

https://dbatools.io/

https://www.databasejournal.com/features/mssql/article.php/1570801/Beware-of-the-System-Generated-Constraint-Name.htm

Clone this wiki locally