Quick and easy copy of a Row to another Row

  • Thread starter Luis Esteban Valencia
  • Start date
L

Luis Esteban Valencia

How would I quickly read several records (rows) from a SQL table, change the
key in each (recordid) and insert them back into the same table thus
creating duplicates.

I'm reading the rows like this:

Dim strSQL As String = _
"SELECT * FROM XMMProjDet " & _
"WHERE Project = '" & Trim(txtProject.Text) & "' and
ProposalNbr = " & Trim(txtCopyFrom.Text)

Dim scnnSol As New SqlConnection(SQL_CONNECTION_STRING)
Dim scmd As New SqlCommand(strSQL, scnnSol)
scnnSol.Open()
Dim myReader As SqlDataReader = scmd.ExecuteReader()

Thanks much.
 
L

Luis Esteban Valencia

Yes, this would work BUT the recordid would be duplicated. I need to be
able to change just one or two fields in each record as they are copied.
I'm trying to avoid reading the row and copying ALL the values out to
individual vars (there are a lot of columns), change the two vars that I
need and then insert them into the table
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top