February 8, 2007 at 6:09 pm
Heh... looks like you've been bitten before, eh Juan?
So far as the ANSI_NULLs thing goes, the default setting, when you create an SQL Server instance, is ON. Unless someone changed it, it shouldn't need to be explicitly set especially in a trigger.
So far as the ANSI_Warnings, it's mostly for GUI code that you would want this to be OFF just as you would want SET NOCOUNT to be ON to keep from giving "false" result sets to the GUI. However, updates, inserts, and deletes to tables with indexes on computed columns or indexed views will fail (according to Books Online) if ANSI_Warnings is set to OFF. Same holds true for ARITHABORT and a couple of other settings.
Bottom line is that the server defaults will do everything you need to if no one messed around with the default settings and you shouldn't have to explicity set them except in the rare instance of some PFM. If you want to feel better about the triggers, though, you can still set them... just don't do it right after the "AS"... check the rowcount first.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 9, 2007 at 12:10 am
What a waste to fire a trigger when nothing has really happened. What could you possibly want to do? You have pretty much no information to do anything with.
February 9, 2007 at 7:38 am
Maybe to have something else happen just because there was no records affected?
February 10, 2007 at 12:29 am
Yep... like maybe to send an email to notify of a zero rows situation or maybe just log that nothing happened... hadn't thought about that before.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply