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

T

Status
Not open for further replies.

sigasg

Technical User
Sep 25, 2002
3
0
0
IS
I have two tables with 1 to many relation my_table_1 and my_table_2 which are related by my_field_1. Sometimes I need to add new revision were I create new record in my_table_1, but I want to rename the related records in my_table_2 so they will connect to the new record in my_table_1. I tried to use the code below but after one record the scan loop is terminated. Does anybody have idea how to do this.

**************** Add revition to mytable_2
SELECT my_table_2
SET FILTER TO my_table_2='???'
SCAN
my_table_2.my_field_1="my_field_1_rev"
ENDSCAN
 
Try it this way:
Code:
SELECT my_table_1
STORE SET("RELATION") TO cOldRelation
STORE my_table_1.my_field_1_rev TO m.my_field_1_rev
SET RELATION TO

SELECT my_table_2
SET FILTER TO

SCAN FOR my_table_2.my_field_1 = '???'
   REPLACE my_table_2.my_field_1 WITH m.my_field_1_rev
ENDSCAN
SELECT my_table_1
SET RELATION TO &cOldRelation
Dave S.
[cheers]
 
select my_table_1
store my_table_1.my_field_rev to m_my_field_1_rev
update my_table_2 set ;
my_field_1 = m_my_field_1_rev ;
where my_field_1 = '???'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top