i have a table which has the following columns
i have another table as follows
this is to be done
* if A_date and B date are equal, one record shoould be entered to the TABLE 02. the values should be A_ID,B_ID,A_Value_B_Value and A_Date (since the date is equal, no problem; even can insert B_Date instead of A_Date)
* if A_Date and B_Date are different, then the following should happen
insert one record to TABLE02 as A_ID,B_ID, A_Value, 0 , A_Date
insert another record to TABLE02 as A_ID,B_ID, 0 , B_Value, B_Date
(As you can see, when the date differs we enter the single record of Table 01 into 2 recoerds in table 02. the Value column and Date column are related in such a way that when A's date is entered, the value for B should be 0 and vise versa..)
i tried having a UDF but in halfway remembered that we cannot include INSERTS in UDFs..
can anyone please explain me how can i solve this problem ??
PS: For your reference , i've sketched a diagram. please click on this link to view it for further clarifications
thanks in advance
View Complete Post