How to Insert into new table, then delete from old table

Discussion in 'ASP .Net' started by D, Sep 1, 2006.

  1. D

    D Guest

    Hello everyone -
    General question. How would I create a SQL code in ASP that
    will insert selected records into a new table, and then delete those
    same records from the original table in one command? I can INSERT INTO
    and DELETE individually but I want them to run in conjunction with
    each. Here is my sample code

    SQL = "INSERT INTO tbl_Cancelled SELECT * FROM Tbl_employee where EmpID
    like '" & request.querystring("EmpID") & and deleted='yes'"'"
    D, Sep 1, 2006
    1. Advertisements

  2. D

    Mark Rae Guest

    Sounds like a prime candidate for a trigger to me...,GGLG:2006-28,GGLG:en&q="SQL+Server"+trigger
    Mark Rae, Sep 1, 2006
    1. Advertisements

  3. D

    D Guest

    Hi Mark...
    I should've been more clear on this topic. These files are stored
    on a standard web server running .asp pages that utilize MS Access d/b.
    I am using some SQL code for my actions within the .asp page. Triggers
    are not an option for this particular application.
    D, Sep 1, 2006
  4. D

    Mark Rae Guest

    Well, the Jet engine certainly supports transactions, so I guess that would
    be the way to go...
    Mark Rae, Sep 3, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.