Hi.
There are 3 systems a customer might have:
ancient, old, and new.
I'm trying to write a t-sql script which will be safe to run on any of the 3,
and upgrade appropriately.
unfortunately, I find that if I have a script like this, it won't compile if
running against a new system lacking col1:
if exists (informationsch ema....columns. .)/*missing*/
begin
create table table0 col2 varchar(60)
end
else
if exists (informationsch ema...columns.. )/*ancient*/
begin
alter table add col2 varchar(60)
update table set col2 = col1
alter table drop col1
some other stuff
end
else
if exists (informationsch ema...columns.. )/*old*/
begin
some other stuff
end
Is there someway of writing some code to update correctly using t-sql and
handling this?
thanks
Jeff Kish
There are 3 systems a customer might have:
ancient, old, and new.
I'm trying to write a t-sql script which will be safe to run on any of the 3,
and upgrade appropriately.
unfortunately, I find that if I have a script like this, it won't compile if
running against a new system lacking col1:
if exists (informationsch ema....columns. .)/*missing*/
begin
create table table0 col2 varchar(60)
end
else
if exists (informationsch ema...columns.. )/*ancient*/
begin
alter table add col2 varchar(60)
update table set col2 = col1
alter table drop col1
some other stuff
end
else
if exists (informationsch ema...columns.. )/*old*/
begin
some other stuff
end
Is there someway of writing some code to update correctly using t-sql and
handling this?
thanks
Jeff Kish