VijayaRagavan
VijayaRagavan

Reputation: 221

Applying change to default value of a column

I recently applied changes to a column by adding default values to a column of datatype datetime. But it doesn't apply to the already existing columns. Am i missing anything?

Upvotes: 0

Views: 38

Answers (1)

Alma Do
Alma Do

Reputation: 37365

It will not work such way because at the time you're changing column's default value, your records already exist. To change them, use UPDATE, like:

UPDATE t SET col='new_default_value'

default value is the thing which is applied to newly created rows if the corresponding column value was not set.

Upvotes: 2

Related Questions