Home All Groups Group Topic Archive Search About

Retrospectivly apply a default constraint

Author
3 Aug 2006 2:48 PM
Russell
I have the code below which will add the default constriant I want. Is there
anyway to make it apply retrospectivly to the existing records?

ALTER TABLE JOB WITH CHECK ADD CONSTRAINT [Setpermanent] DEFAULT 'P'  FOR
USR_VB_JOBTYPE

Author
3 Aug 2006 2:56 PM
Tav
Russell wrote:
> I have the code below which will add the default constriant I want. Is there
> anyway to make it apply retrospectivly to the existing records?
>
> ALTER TABLE JOB WITH CHECK ADD CONSTRAINT [Setpermanent] DEFAULT 'P'  FOR
> USR_VB_JOBTYPE

Isn't it just simply:

UPDATE JOB SET USR_VB_JOBTYPE = 'P' WHERE USR_VB_JOBTYPE IS NULL

....or am I missing something!

Regards,

-Tav.-
Tavis Pitt

AddThis Social Bookmark Button