Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Alter table
Fri, Feb 1 2013 12:03 PMPermanent Link

Enrico Lago

Is possible to add a new column with a initial value as an already existing column?
Something like at...

alter table MyTable add column if not exists MyColumn Varchar(256) as column AlreadyExistingColumn;
Fri, Feb 1 2013 1:06 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Enrico

>Is possible to add a new column with a initial value as an already existing column?
>Something like at...
>
>alter table MyTable add column if not exists MyColumn Varchar(256) as column AlreadyExistingColumn;

No but you can do it as a script


alter table MyTable add column if not exists MyColumn Varchar(256);
update MyTable set MyColumn = AlreadyExistingColumn;

Roy Lambert [Team Elevate]
Image