I have been reading through Robyn Page's SQL Server Cursor Workbench and she has an example of a "quirky update" like so...
Create tables used.
Now for the quirky update
Now why is that a better way of doing things than just taking the original
asked Feb 17, 2010 at 10:07 AM in Default
(I tried to make this a comment to Jeff's answer, but it is too long)
Jeff makes good points, and there are times when a quirky update is appropriate. As he mentioned, it tends to be faster than most other solutions and uses only T-SQL.
But I counsel caution before using it. Remember that even if you are fully comfortable with "Black Arts" coding, in many organizations the person who maintains the code you write is likely to not be you, or at least not always you for the whole time it is in production. The next person probably will not understand it fully, so if you do use it, I suggest commenting it excessively.
Also, remember this is not part of the SQL Standard. This means nothing if you are using SQL Server only, but I try to use standards compliant code unless there is a good reason not to.
This is a perfectly valid technique that will work consistently if you write it correctly, and is very unlikely to be changed in a mere service pack (and fairly unlikely to be changed in any major release in the near future). Still, it is one that is hard for many people to understand and it is not standards compliant, and those are reasons to judge carefully if it is worth using.
answered Feb 22, 2010 at 06:16 PM