Add a Default to an Existing Table T-SQL

A quick implementation for adding a default value to an existing column in a table …the following example adds a default constraint “YourDefaultConstraintName” of 0 (zero) to the column “YourColumn” in the table “YourTable” …

ADD  CONSTRAINT YourDefaultConstraintName
DEFAULT (0) FOR [YourColumn]


If the constraint already exists you will need to drop it first then add the constraint with the same name but with the new default value…Drop constraint sample code here …

ALTER TABLE YourTable DROP CONSTRAINT YourDefaultConstraintName

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s