alter table enquiry alter column RejectReson int default 0
I want alter the column data type with default value zero,but it is not happening.
Join Stack Overflow to learn, share knowledge, and build your career.
alter table enquiry alter column RejectReson int default 0
I want alter the column data type with default value zero,but it is not happening.
If you want to affect existing rows, then use with values
:
alter table enquiry
add constraint dft_enquiry_rejectreason default 0 with values;
This is explained in the documentation:
. . .
WITH VALUES
can be used to store the default value in the new column for each existing row in the table.
Use ADD CONSTRAINT
.
For example:
ALTER TABLE enquiry ADD CONSTRAINT some_name DEFAULT 0 FOR RejectReson;