May 2, 2002 at 7:45 pm
Hi there everyone!
I have a problem that I am finding is beyond my limmited experience in SQL programing. I want to write a trigger that will do the following.
I have Three tables T1, T2 and T3. The primary key in T1 links to T2 but T2 has a different primary key. T1 also links to T3 in the same manner. IE both are 1 to many relationships. When a new entry is made in T2 I need to check if there was data entered into a particular field (F1). The data will NOT be a particular value but it will be an intiger. If there is data entered then I need to use the value in F1 to calculate a new values for T3 and insert them as a new record. T3 will have an at least one existing record for the primary key in T1 and I will have to select the newest of these values based on date and change them according to the value calculated from T2. T2 will also have at least one other trcord for the T1 primary key. I will need to select the new one and the one previous to the new one and subtract the old one from the new one. this value , which could be nerative will then be added to the fields in T3 How can I do this???? I was thinking that maybe it could all be done in a trigger? or would a stored procedure be better? Can anyone help me work this stuff out??
Thanks in advance
May 3, 2002 at 7:54 am
Yes a trigger sounds best however the flow here lost me. Can you write out the flow and provide the DDL of the tables so we can take a look and see if we can offer any suggestions.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
May 5, 2002 at 6:13 pm
Antares686 I do not seem to be able to attach images (at least they do not show in the preview)etc here and I do not have an accessable web site . This is my email phil.miles@nre.vic.gov.au. Can you send a blank email so I can forward the info to you???
Thanks for your response
Edited by - philrmiles on 05/05/2002 6:24:33 PM
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply