>CREATE CURSOR table1(code c(4),names c(10),debit n(4),credit n(4),code2 c(4)) >INSERT into table1 VALUES ('3201','Apple',100,0,'') >INSERT into table1 VALUES ('3203','Mango',125,0,'') >INSERT into table1 VALUES ('3204','Date',200,0,'') >INSERT into table1 VALUES ('3202','Orange',350,0,'') > >>
INSERT INTO table1 (Code, Names, Debit, Credit, Code2) ; SELECT NewCodeValue, Names, Credit, Debit, Code ; FROM table1I'll guess that you actually will need a WHERE clause for the SELECT, so you only insert the rows that don't already have matches.
UPDATE table1 ; SET code2 = t1.code ; FROM table1 t1 ; WHERE table1.code = t1.code2 AND EMPTY(table1.code2)Tamar