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

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

Mark Rae

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
 
D

D

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.
 
M

Mark Rae

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...
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top