|
Posted by Jeff Kish on 05/16/06 23:35
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 (informationschema....columns..)/*missing*/
begin
create table table0 col2 varchar(60)
end
else
if exists (informationschema...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 (informationschema...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
Navigation:
[Reply to this message]
|