Remove-DefaultConstraint

Removes a default constraint from a table.

Syntax

Remove-DefaultConstraint [-TableName] <String> [-SchemaName <String>] [-ColumnName] <String> [<CommonParameters>]
Remove-DefaultConstraint [-TableName] <String> [-SchemaName <String>] -Name <String> [<CommonParameters>]

Description

The Remove-DefaultConstraint operation removes a default constraint from a table.

Parameters

Name Type Description Required? Pipeline Input Default Value
TableName String

The name of the target table.

true false
SchemaName String

The schema name of the target table. Defaults to dbo.

false false dbo
ColumnName String

OBSOLETE. Use the Name parameter to remove a default constraint.

true false
Name String

The name of the default constraint to remove.

true false

EXAMPLE 1

Remove-DefaultConstraint 'Cars' -Name 'Cars_Year_DefaultConstraint'

Demonstrates how to remove a default constraint. IN this case, the Cars_Year_DefaultConstraint constraint will be removed from the Cars table.