View Single Post
Old February 24th, 2005, 01:37 PM
bleutiger bleutiger is offline
Authorized User
Join Date: Jan 2005
Location: , , .
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default Recordset delete question/problem

My question is this...

In the code below my first sql statement updates a table.

my second then grabs all data from that table and chooses the ones that are "deactivated"

I am then inserting those "deactivated" records into a new table.

I want to delete the deactivated data from the first table. can I use the same recordset that I used for the previous insert or do I have to create a new recordset?

here is the code.....SQL Server by the way...

deaID = request("deaID")

    sql = "update dealerships set dactive=0 where deaID=" & deaID
    set deldealer = conn.execute(sql)

    sql2 = "SELECT * FROM dealerships WHERE dactive=0"
    set rs = conn.execute(sql2)

    DO While not rs.eof
        sql3 = "INSERT INTO inactivedealerships (Blah, blah, blah) VALUES ("BLAH, BLAH, BLAH")"

        set rs2 = conn.execute(sql3)