October 3, 2007 at 6:31 pm
Ninja's_RGR'us (10/3/2007)
Just kidding :w00t::D:hehe::cool::):D:P;).
I know.
Don't worry about that.
:smooooth:
_____________
Code for TallyGenerator
October 4, 2007 at 7:36 am
Sergiy (10/3/2007)
Would not UPDATE() work in INSERT case?It will work perfectly.
Yes, it will return "TRUE" for every column, but what does it change?
We still have to run the same script if the column is updated.
No matter how many other columns are updated as well.
So, what's a point to copy-paste the trigger into another trigger not having IF UPDATE() statement?
Should I list all disadvantages of "copy-paste" programming?
Or you gonna admit you both been dumb in this case?
Sergiy,
If you read ( can you ?) my post it clearly says that it only "make sense" to use it when Update trigger is available.
Why would you duplicate code?
1. "PERFORMANCE". Why would I have to check for something I don't need to check?
We still have to run the same script if the column is updated.
WRONG.
2. You have to run it if the column is updated AND it was updated with a DIFFERENT value which you can only tell if the deleted table is populated which does NOT happens on an insert trigger.
Sorry but you should brush up on the TRIGGER PROGRAMMING section in BOL :hehe::hehe:
.... no offence :D:D:D
* Noel
October 4, 2007 at 8:46 am
It's a good thing that Sergiy has no ego problems... cause that would have been a bad day for him :D.
October 4, 2007 at 1:57 pm
noeld (10/4/2007)
1. "PERFORMANCE". Why would I have to check for something I don't need to check?
Can you prove your point?
Did you ever experience performance losses die to IF UPDATE() check?
Is everything else in your code so perfect that IF UPDATE() becomes the greatest concern?
If that's the case - my congratulations. You life must be now really boring.
WRONG.
2. You have to run it if the column is updated AND it was updated with a DIFFERENT value which you can only tell if the deleted table is populated which does NOT happens on an insert trigger.
It's a question of compromise.
You need to check if the record exists in deleted. Check against empty in-memory table versus supporting and managing 2 identical pieces of code.
What you programming teacher would advise you to choose?
Sorry but you should brush up on the TRIGGER PROGRAMMING section in BOL :hehe::hehe:
It's not about TRIGGER PROGRAMMING.
It's about PROGRAMMING.
The most effective code is ASSEMBLER code.
Any other PL performs worse.
Any call for subroutine ALWAYS slows program execution down.
Would you recommend not to reuse code?
Sorry but you should brush up on the PROGRAMMING tutorials.
😛 😀
_____________
Code for TallyGenerator
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply