468,540 Members | 2,021 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,540 developers. It's quick & easy.

change default value of column

Hi friends,

I have a table :
create table abc (a int,b smalldatetime default getdate())
then insert value like
insert into abc(a) values(1)
now I want to change default value of column b be getdate()+(0.435)
so how can I do ?
please help. Its urgeny.
Sep 28 '07 #1
5 4971
ck9663
2,878 Expert 2GB
Hi friends,

I have a table :
create table abc (a int,b smalldatetime default getdate())
then insert value like
insert into abc(a) values(1)
now I want to change default value of column b be getdate()+(0.435)
so how can I do ?
please help. Its urgeny.

try doing an ALTER TABLE
Sep 28 '07 #2
I tried but it was not working
Oct 2 '07 #3
ck9663
2,878 Expert 2GB
I tried but it was not working
if this is a one time thing, try creating a new field then drop the existing one.
Oct 2 '07 #4
ck9663
2,878 Expert 2GB
oh yeah, you have to rename the field to the old field name after dropping the old one.

IF this is a one time thing...
Oct 2 '07 #5
Hi friends,

I have a table :
create table abc (a int,b smalldatetime default getdate())
then insert value like
insert into abc(a) values(1)
now I want to change default value of column b be getdate()+(0.435)
so how can I do ?
please help. Its urgeny.
Hey try like this...

create table abc (a int,b smalldatetime constraint df_abc_b default getdate())
insert into abc(a) values(1)
select * from abc

alter table abc drop constraint df_abc_b
alter table abc add constraint df_abc_b default(getdate()+0.435) for b
insert into abc(a) values(1)
select * from abc
Oct 3 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

30 posts views Thread by Bruce Momjian | last post: by
7 posts views Thread by Konstantin Andreev | last post: by
1 post views Thread by Frank Swarbrick | last post: by
3 posts views Thread by =?ISO-8859-2?Q?Gregor_Kova=E8?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.