Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating primary key?

Status
Not open for further replies.

vijay253

Technical User
May 6, 2006
1
US
Have Two tables A(Source with 1 record) and B(Target empty), and I have to load the data from A --> B and increment the key value in A(Source) after loading B and update the key value row in table A.

Step 1:
Table A --> Table B
1 --> 1

Step 2:
Table A --> Table A
1+1 --> 2

Can you please let me know how to go about it...

thanks,

 
Try Step 1 with post-SQL in the target:

Code:
Update table A
Set primary key = primary key +1;

A pretty meaningless exercise.

Are you trying to pass an exam?

Ties Blom

 
My recomendation is.....

Insert other field in the table A and change the value of this field (like a flag) when you pass the information to the table B.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top