sql - Best way to prevent Update -


I have a situation where we want to stop updating the table for a specific scenario.

So for 95% of the updates, I want to streamline the update normally and want to update the desired areas .... For that other 5%, I want to stop updating. The update will be based on the data given in the table which is currently populated in the table.

That's why a good example is that users present their time for today. If they resubmit their time, then I do not want DB to allow that update as the time table for that user has flagged that they have already submitted their time and the time zone is not zero.

I was playing with triggers for this and it allows me to handle it at the beginning of the trigger ... basically only update, if the criteria are true.

Any thoughts?

Edit: I'm sorry ... maybe this was not a good example. We reuse an updated sproc to make several different updates, so this is quite common. I wanted to know what is the best way for those cases where I do not want to update. Using a trigger was a security measure to prevent someone from accidentally typing data previously recorded. Thanks for the input

** EDIT2: ** Thanks ... after thinking through it ... Martin is right I should just build arguments in sproc I was told they assumed it You want to use a trigger, but you are all right ... this is not just the right way to handle it. Thanks for your help.

thanks

you trigger for it Do not require some sort of

  update users time zone = @timefield WHERE UserId = @UserId and [days] = @ day and timefield null  

Example. You can then check the affected rows to see if any of them was actually updated or not.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -