If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Trigger to Insert or Update 2nd Table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-11-04, 11:24
ACochran ACochran is offline
Registered User
 
Join Date: Mar 2004
Posts: 5
Trigger to Insert or Update 2nd Table

I am new to triggers and need help on the following:

I have a hourly table that inserts new rows every hour but I need to either Insert or Update the daily table with the sum of the reading from the hourly table. If a row exist in the daily table with the date of the hourly table, then I need to update this row but if it doesn't exist, I need to insert this row.

Thanks for any suggestions...

Alan
Reply With Quote
  #2 (permalink)  
Old 03-11-04, 12:27
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Trigger to Insert or Update 2nd Table

What DBMS? Sounds like you should be using a materialized view (snapshot).
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 03-11-04, 13:45
ACochran ACochran is offline
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks for replying, I have since moved this thread to the Microsoft SQL Server forum after posting to wrong forum. The DBMS is SQL2000

Thanks...
Alan
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On