Update Trigger

Posted on 2013-01-25
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]

       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


Open in new window

Question by:PtboGiser
LVL 40

Accepted Solution

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:

Author Comment

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


Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

821 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