Results 1 to 2 of 2

Thread: Tricky question....

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    alb, nm 87112
    Posts
    56

    Post

    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!

  2. #2
    Guest

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width