Subject Re: Interbase / Delphi stored procedure
Author frank.ingermann@klar-partner.de
Hi Wayne,

in general i would avoid fluctuations in the metadata, so i would
prefer your suggestion of using the same table. Since the structures
of your tables are the same, you can simply do a

insert into history_tbl select * from monthy_rotation_tbl

and then just

delete from monthy_rotation_tbl
(at least if your foreign keys will allow that...)

when a month is done. ( i used to use a lot of those daily/monthly
tables in paradox & dbase, but IB is a different piece of cake... ;-)

hth,
Frank "fingerman" Ingermann


--- In IBObjects@y..., Wayne@b... wrote:
> Hi all,
>
> I have a history table and a current table in my app. The fields are
> identical in each.
>
> the fields are:
> shift, date, employee
>
> combined they are unique.
>
> say my current table is February2001_rotation_tbl. Now it is nearing
> the end of february and the march rotations need to be done. I want
> 1> a stored procedure to copy all the data from
> february2001_rotation_tbl to the history table
> and then
> 2> afterwards delete all the records in february2001_rotation_tbl
> and
> 3>rename february2001_rotation_tbl as March2001_rotation_tbl.
>
> Can this be done? and if so how? I have to consider that this table
> will have foreign keys in it and will be refered to by other tables.
> I may have to rather have a tablename that remains the same and
> doesn't change, say like monthy_rotation_tbl ???
>
> TIA
>
> Wayne Bruton