Subject | Re: [ib-support] FB/IB SQL Copy |
---|---|
Author | Woody |
Post date | 2002-01-02T17:56:19Z |
From: "Daniel Bertin" <bertin@...>
Set Term ^;
CREATE PROCEDURE MoveTableARows(StartDate Date, EndDate Date)
RETURNS Complete CHAR(1)
AS
Begin
Complete = "T";
Insert into TableB Select * from TableA where TableA.DateField between
:StartDate and :EndDate;
Delete from TableA where DateField between :StartDate and :EndDate;
When Any do
Complete = "F";
EXIT;
end^
Set Term ;^
HTH
Woody
>Try this: (it is untested and off the cuff)
> How can I do a SQL to move a bunch of rows from one table to another
> (identical) table?
>
> I want to move all the rows, where current_date - 30 from tableA to TableB
> then remove the rows from tableA
Set Term ^;
CREATE PROCEDURE MoveTableARows(StartDate Date, EndDate Date)
RETURNS Complete CHAR(1)
AS
Begin
Complete = "T";
Insert into TableB Select * from TableA where TableA.DateField between
:StartDate and :EndDate;
Delete from TableA where DateField between :StartDate and :EndDate;
When Any do
Complete = "F";
EXIT;
end^
Set Term ;^
HTH
Woody