﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / General / SQL Server 7,2000  / Creating triggers / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 12:37:32 GMT</lastBuildDate><ttl>20</ttl><item><title>Creating triggers</title><link>http://www.sqlservercentral.com/Forums/Topic450001-9-1.aspx</link><description>I need a little help with creating trigger. I am trying to update a particular field in one table after a change is made to a field in another table. Here is the scenario:A user will update a field;this field will become a null value. At this point, I would like a field in another table to become blank. I think my issue is that the table that is being updated by the user does not directly link to the table being updated after the trigger. Here is what I have:CREATE TRIGGER reset_AssignON 1sttable  FOR UPDATEASBeginIF update(hCurrentCamRule) /*field from 1sttable */       IF NULL = (Select i.hCurrentCamRule From inserted i) 	  IF  'Garage' = (Select i.sDesc from Inserted i)	IF Exists (Select * from 2ndtable b Inner join inserted i2 on i2.hCurrentCamRule = b.hMy                     join 3rdtable c on c.hCode = b.htenant)UPDATE 3rdtable set sfield = ''	From 3rdtable c2 Join 2ndtable b2 on c2.hCode = b2.htenant join inserted i3 on i3.hCurrentCamRule = b2.hMy			ENDAny help would be appreciated.Thanks!</description><pubDate>Thu, 31 Jan 2008 08:47:12 GMT</pubDate><dc:creator>Tammy Robinson</dc:creator></item></channel></rss>