Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

How to select and duplicate the records and update some column values using cursor

$
0
0

I have a table with 920 records, we need to update the end date to 6/30/2014 for 920 records and I need to create all 920 records with start date is 7/1/2014 and update the external value to CCC.

Note: the table primary key is not auto increment, but I have sp to get the latest key for that.

Existing table.  

ID

Source Name

Internal value

External value

Start date

End date

1

XXX

AAA

BBB

1/1/2013

6/30/2015

Create new records

ID

Source Name

Internal value

External value

Start date

End date

921

XXX

AAA

CCC

7/1/2013

12/30/2015


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>