By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,265 Members | 1,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,265 IT Pros & Developers. It's quick & easy.

db upgrade code

P: n/a
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
May 16 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.