troubleshooting Question

Breaking up triggers

Avatar of Robert Burns
Robert Burns asked on
Microsoft SQL Server
4 Comments1 Solution490 ViewsLast Modified:
Greetings all - I have a trigger that (I think) I need to break out into two functions.  What's happening now is that new records aren't getting sent into my FM_Location table no matter how they're filled in.  If you update the record it populates just as you'd expect it to.

My other experiences with these triggers can be found here:

https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21311566.html

And here:

https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21482068.html

Here is the current trigger:

CREATE TRIGGER FM_Insert_Location
ON spemp
FOR INSERT, UPDATE
AS
INSERT FM_Location
select
i.email_address, i.spbldinf_code, i.spfloors_code, i.spbldrom_code, 'N', GetDate()
from inserted i join deleted d on i.spemp_code = d.spemp_code
where i.spbldrom_code <> d.spbldrom_code and IsNull(i.email_address, '') <> ''






Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros