Re: PLEASE HELP! how to delete columns ...

From: <James>
Date: 1995/05/04
Message-ID: <1995May4.113708.1557_at_newton.ccs.tuns.ca>#1/1


In article <D7ys1I.Ewy_at_CSUFresno.EDU> stevec_at_zimmer.CSUFresno.EDU (Steve Cosner) writes:
>
>In article <1995May1.113615.91879_at_kuhub.cc.ukans.edu> mahesh_at_tisl.ukans.edu (Rachakonda Satya) writes:
>>

 ...text deleted
>>
>>Now, I want to delete a few columns from the data definition itself.
>>I see that either ALTER TABLE or DROP would not work. Can somebody
>>please help me with this?
>>
>>...text deleted
>>University of Kansas, Lawrence off: (913) 864-7374
>>mahesh_at_cecase.ukans.edu fax: (913) 864-7789
>
>
>
>Whenever you create a table, store the SQL so you can reuse it.
>
>We ALWAYS store the SQL used to create a table. In the development of
>a new system, it is a regular occurrence that columns are added or
>dropped, keys and constraints are changed, storage parameters are
>changed, etc.
>
>It is a simple matter, to edit the SQL to create the table, and then
>run a batch (background) job to drop and re-create the table.
>
>The same job can be run by several developers of the system, so they
>each have a current version of the table to use in thier testing
>environment.
>
>Hope this helps.

I agree with this but...
If you're working with live data, add to your *.SQL script to; rename current to old, create new, recreate indexes, regrant privilages, INSERT INTO new SELECT matching_columns FROM old;

DON'T DROP THE OLD TABLE for 6 months to 1 year. You may need the (now) discarded data
once the users changes their minds again.

As an alternative...
create a table with the unique key column and the deleted column(s). Then you can drop the old table, with duplicated (now) data. Received on Thu May 04 1995 - 00:00:00 CEST

Original text of this message