Triggers and restoring old data.
Posted in 1994
Adam Skeggs (ajs@labsys.com.au) wrote:
>I have been charged with solving a nasty problem.
>I must create a program that must insert some old data from tape
>into a couple of tables. The trick is that the tables may have
>changed slightly; there may be new columns, maybe a column name
>change, maybe a column set to "not null".
>The first thing I want to do is to deal with the case where a new
>"not null" column has been added. I guess I can load the data in
>ok but I need to get a default value for the new column from somewhere.
Why not load the data anyway and then run an UPDATE statement:
load from tapefile insert into tablename;
update tablename set somecol=default_value where somecol is null;
** Opinions expressed are my own and not necessarily those of my employer
=========================================================================
Barry Toomey Phone +353-1-2822333
AT&T Network Systems Ireland Fax +353-1-2822864
Corke Abbey Avenue, email: bt@irl3b2c.att.com
Bray, uunet: att!irl3b2c!bt
Co. Dublin
Ireland
=========================================================================