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

  • Thread starter Thread starter D
  • Start date Start date
D

D

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'"'"
 
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'"'"

Sounds like a prime candidate for a trigger to me...

http://www.google.co.uk/search?sour...G,GGLG:2006-28,GGLG:en&q="SQL+Server"+trigger
 
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.
 
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.

Well, the Jet engine certainly supports transactions, so I guess that would
be the way to go...
 
Back
Top