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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update the Same Field in 2 Rows at Once

Status
Not open for further replies.

rhnewfie

Programmer
Jun 14, 2001
267
CA
I have two rows of data with a 3 field concatenated key, sometimes a situation arises where I must switch the first field in the key with another row:

Row 1 Key: ABC
Row 2 Key: DEF

After Switch:

Row 1 Key: DBC
Row 2 Key: AEF

Has someone had to do this before and if so how? Everything I try gives me violations on the PK or FK. Thanks in advance

RHNewfie There are 3 Types of People in the World
Those Born to Think Logically
Those that can Learn to Think Logically
Those that Shouldn't Try
 
I would try to do this by inserting a new row with the key rearranged the way you want. Then you can update the foreign keys in the child tables to point to the new row. If everything goes well, you can then delete the original row.
 
Thanks for the help. That works fine for me.

RHNewfie There are 3 Types of People in the World
Those Born to Think Logically
Those that can Learn to Think Logically
Those that Shouldn't Try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top