Solved

Update Trigger

Posted on 2013-01-25
2
273 Views
Last Modified: 2013-02-05
I would like to pull the Street_Full_Name and AnnoName columns from my Street Table Where StreetID in the Segment Table = StreetId in the Street Table when there has been a insertion or Update on my Street.
AS well i will need it to fire or a separate Trigger to fire when there has been and insertion or Update on the Segment table
How best to handle something like ?
Segment Table Trigger(which is not working)
ALTER TRIGGER [dbo].[FName_AName_Num_Las<wbr ></wbr>tdate_Cont<wbr ></wbr>_Segment] ON [dbo].[Segment]
    AFTER INSERT, UPDATE
AS
    BEGIN
        SET NOCOUNT ON;

       UPDATE Segment
        SET     Street_Full_Name = st.Street_Full_Name,
                AnnoName = st.AnnoName
        FROM    dbo.Segment s
                INNER JOIN INSERTED i ON s.OID = i.OID
                INNER JOIN dbo.Street st ON s.Street_ID = st.Street_ID

    END

Open in new window

0
Comment
Question by:PtboGiser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 500 total points
ID: 38819189
You need to put a INSERT UPDATE trigger on dbo.Street  and that action will fire the triggers on dbo.Segment but you also need to make sure the recursive trigger SQL setting is on:

http://msdn.microsoft.com/en-us/library/ms188124(v=sql.100).aspx
0
 

Author Comment

by:PtboGiser
ID: 38854848
I've requested that this question be deleted for the following reason:

thx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
T-SQL: Only Wanting One Record 8 59
How to use Recordset, returned from a SPROC as the recourdsource of a form. 24 49
Error in Visual Project 10 47
HIghlights of SSIS? 3 42
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how the fundamental information of how to create a table.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question