Tuesday, March 29, 2016

Add column with default value and nullity

create table something
p int not null

insert into something(p) values(1);

alter table something
add q int default 6 not null;

alter table something
add r int default 8 null;

select * from something;

Postgresql output:
p q r
1 6 8

Sql Server output:
p q r
1 6 null

No comments:

Post a Comment