PDA

Click to See Complete Forum and Search --> : Tricky question....


Dan0331
Dec 9th, 1999, 12:38 AM
Hi Everyone,

I have a database with multiple tables. All tables are identical in structure, and the inforamtion that they could possibly contain.

My question is this. How can I move a group of records from all the tables at once, by simply having a user enter a beginning criteria, and an ending criteria (i.e. Date). I have no problem getting everything to move at once, but I want to be able to move select records from each table to another table at one time.

Any suggestions that don't involve rewriting half of my code?

Thanks!

Dec 9th, 1999, 09:51 AM
Your code will probably look something like this:

BEGIN TRANSACTION

INSERT INTO Table3
SELECT *
FROM Table1, Table2
WHERE DATE BETWEEN BeginDATE AND EndDATE;

DELETE FROM Table1, Table2
WHERE DATE BETWEEN BeginDATE AND EndDATE;

END TRANSACTION