question

JeffAngelo avatar image
JeffAngelo asked

I am trying to understand what the reasoning is behind this update. Has anyone seen anything like this?

--SQL Profile when updating the destination city of a pickup UPDATE dispatch..pickup SET comments=NULL,destcity='City test',changedby='sbruneau',lastupdate='2015-10-08 10:17:11' WHERE pickupid=123456 AND comments='' AND destcity='Scarborough' AND changedby IS NULL AND lastupdate IS NULL --SQL Profile when changing the destination city back UPDATE dispatch..pickup SET destcity='City',lastupdate='2015-10-08 10:17:24' WHERE pickupid=123456 AND destcity='City test' AND lastupdate='2015-10-08 10:17:11'
update
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tom Staab avatar image Tom Staab ♦ commented ·
Wow, Thomas. Documentation? I had to look that one up to remember what it is. I've heard of it before, but we are always told to work on something else whenever someone mentions it. ;)
2 Likes 2 ·
ThomasRushton avatar image ThomasRushton ♦♦ commented ·
And I guess that there's no documentation or anyone to ask...
1 Like 1 ·
ThomasRushton avatar image ThomasRushton ♦♦ commented ·
What? You mean you don't write it as you go along? Shame on you, Mr Staab! ;-)
1 Like 1 ·
ThomasRushton avatar image ThomasRushton ♦♦ commented ·
Are there any update triggers that would cause something to be entered in an audit log?
0 Likes 0 ·
JeffAngelo avatar image JeffAngelo commented ·
There are triggers but no audit log is created. I don't see the value of including predicates of an update to check if field values equal what they equal.
0 Likes 0 ·

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
That's an update that's attempting to check to see if the values are the same as what you thought they were when you started your update. It's checking in case some other person had also run an update before. If they data were changed before your update got there, your update would fail. Presumably the application would either throw an error, or it would cause it to refresh so that you saw the new data.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JeffAngelo avatar image JeffAngelo commented ·
thanks Grant
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.