Re: RowID Question (Part 2)
Posted in 1992
Topics: SQL Development & Query Writing, Triggers, Constraints & Referential Integrity, Migration, Import/Export & Data Conversion
In article <3888@copper.Denver.Colorado.EDU> klonz@copper.denver.colorado.edu (K Lonz) writes:
>Once again, my apologies to the veterans!
>
>Many thanks to the varied responses I got, the most reasonable
>of which was that rowids are not sequential at all and don't
>necessarily start with 1. They are probably created by using
>a memory paging scheme.
>
>
>Therefore, my simple question may not be so simple:
>
> The current system uses SE. We are converting to Online 4.1.
> Both systems run on an Amdahl on a Unix kernel. I don't
> know the rev number of the kernel.
>
> We are 'enhancing' the system to use joins on Online. Some
> tables will be modified to use joins to other tables instead
> of keeping the same data in two different places.
>
> However, we need to compare records before and after the
> enhancements to show all data was retained using the joins.
>
> We need some mechanism to correlate records before and after.
> Originally, we thought we may be able to use rowids, but that
> assumption appears to be bogus.
>
> Does anyone have any suggestions on how to correlate
> records before and after an 'unload' and a 'load'?
>
>
>Again, thank you in advance for any responses!
>
>
> klonz
I think that what you want to be cdone can be done. Here's
some pseudocode:
alter table tab adding column id of type int;
insert into tab(id)
select rowid from tab;
alter table tab, modify id to type serial;
create unique index ix on tab(id);
unload tab from old_db;
load tab into new_db;
This gives you the tie between old and new databases, but requires
you modify inserts to have a 0 in the id column (this triggers an
insert of the next serial value).
Sorry, no manual handy, syntax stinks!
thomas rush uunet!cpqhou!thomasr
compaq computer corporation their employee,
deep in the hearth of texas not their opinions.