<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">SELECT Hints, Tips, Tricks FROM Hugo Kornelis WHERE RDBMS = 'SQL Server'</title><subtitle type="html" /><id>http://sqlblog.com/blogs/hugo_kornelis/atom.aspx</id><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/hugo_kornelis/default.aspx" /><link rel="self" type="application/atom+xml" href="http://sqlblog.com/blogs/hugo_kornelis/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.61129.1">Community Server</generator><updated>2007-07-18T01:08:32Z</updated><entry><title>Data modeling: art or science?</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx" /><id>http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx</id><published>2008-08-02T22:04:44Z</published><updated>2008-08-02T22:04:44Z</updated><content type="html">&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;When I started blogging here on &lt;/font&gt;&lt;a href="http://sqlblog.com/"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;sqlblog.com&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;, I intended to write about stuff like T-SQL, performance, and such; but also about data modeling and database design. In reality, the latter has hardly happened so far – but I will try to change that in the future. Starting off with this post, in which I will pose (and attempt to answer) the rather philosophical question of the title: is data modeling an art or a science?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Before I can answer the question, or at least tell you how &lt;b style="mso-bidi-font-weight:normal;"&gt;I&lt;/b&gt; think about the subject, we need to get the terms straight. So that if we disagree, we’ll at least disagree over the same things instead of actually agreeing but not noticing. In the next two paragraphs, I’ll try to define what data modeling is and how it relates to database design, and what sets art apart from science in our jobs.&lt;i style="mso-bidi-font-style:normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size:13.5pt;mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman"&gt;Data modeling and database design&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;When you have to create a database, you will ideally go through two stages before you start to type your first &lt;/font&gt;&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';mso-no-proof:yes;"&gt;CREATE TABLE&lt;/span&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt; statement. The first stage is data modeling. In this stage, the information that has to be stored is inventoried and the structure of that information is determined. This results in a logical data model. The logical data model should focus on correctness and completeness; it should be completely implementation agnostic.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;The second stage is a transformation of the logical data model to a database design. This stage usually starts with a mechanical conversion from the logical data model to a first draft of the implementation model (for instance, if the data model is represented as an &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Entity-relationship_model"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;ERM diagram&lt;/font&gt;&lt;/a&gt;&lt;font face="Times New Roman" size="3"&gt; but the data has to be stored in an &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Relational_database_management_system/"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;RDBMS&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;, all entity and all many-to-many relationships become tables and all attributes and 1-to-many relationships become columns). After that, optimization starts. Some of the optimizations will not affect the layout of tables and columns (examples are choosing indexes, or implementing partitioning), but some other optimizations will do just that (such as adding a surrogate key, denormalizing tables, or building indexed views to pre-aggregate some data). The transformation from logical data model to database design should focus on performance for an implementation on a specific platform. As long as care is taken that none of the changes made during this phase affect the actual &lt;i style="mso-bidi-font-style:normal;"&gt;meaning&lt;/i&gt; of the model, the resultant database design will be just as correct and complete (or incorrect and incomplete) as the logical data model that the database design is based on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Many people prefer to take a shortcut by combining these two stages. They produce a data model that is already geared towards implementation in a specific database. For instance by adding surrogate keys right into the first draft of the data model, because they already know (or think) that they will eventually be added anyway. I consider this to be bad practice for the following reasons:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol style="margin-top:0cm;"&gt; &lt;li class="MsoNormal" style="margin:0cm 0cm 0pt;mso-list:l1 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;It increases the chance of errors. When you have to focus on correctness and performance at the same time, you can more easily lose track.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="MsoNormal" style="margin:0cm 0cm 0pt;mso-list:l1 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;It blurs the line. If a part of a data model can never be implemented at acceptable performance, an explicit decision has to be made (and hopefully documented) to either accept crappy performance or change the data model. If you model for performance, chances are you’ll choose a better performing alternative straight away and never document properly why you made a small digression from the original requirements.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="MsoNormal" style="margin:0cm 0cm 0pt;mso-list:l1 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;It might have negative impact on future performance. The next release of your DMBS, or maybe even the next service pack, may cause today’s performance winner to be tomorrows performance drainer. By separating the logical data model from the actual database design, you make it very easy to periodically review the choices you made for performance and assess whether they are still valid.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="MsoNormal" style="margin:0cm 0cm 0pt;mso-list:l1 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;It reduces portability and maintainability. If, one day, your boss informs you that you need to port an existing application to another RDBMS, you’ll bless the day you decided to separate the logical data model from the physical database design. Because you now only need to pull out the (still completely correct) logical data model, transform again, but this time apply optimization tricks for the new RDBMS. And also, as requirements change, it is (in my experience) easier to identify required changes in an implementation-independent logical data model and then move the changes over to the physical design, than to do that all at once if only the design is available.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="MsoNormal" style="margin:0cm 0cm 0pt;mso-list:l1 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;It may lead to improper choices. More often that I’d like, I have seen good modelers fall victim to bad habits. Such as, for instance, adding a surrogate key to &lt;b style="mso-bidi-font-weight:normal;"&gt;every&lt;/b&gt; table (or entity or whatever) in the data model. But just because surrogate keys are &lt;i style="mso-bidi-font-style:normal;"&gt;often&lt;/i&gt; good for performance (on SQL Server that is – I wouldn’t know about other DBMS’s) doesn’t mean they should &lt;i style="mso-bidi-font-style:normal;"&gt;always&lt;/i&gt; be used. And the next step (that I’ve witnessed too!) is forgetting to identify the real key because there already is a key (albeit a surrogate key).&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size:13.5pt;mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman"&gt;Art and science&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;For the sake of this discussion, “art” (work created by an artist) is the result of some creative process, usually completely new and unique in some way. Most artists apply learned skills, though not always in the regular way. Artists usually need some kind of inspiration. There is no way to say whether a work of art is “good” or “bad”, as that is often in the eye of the beholder – and even if all beholders agree that the work sucks, you still can’t pinpoint what exactly the artist has done wrong. Examples of artists include painters, composers, architects, etc. But some people not usually associated with art also fit the above definition, such as politicians, blog authors, or scientists (when breaking new grounds, such as &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Codd"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;Codd&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt; did when he invented the relational model). Or a chef in a fancy restaurant who is experimenting with ingredients and cooking processes to find great new recipes to include on the menu.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;“Science” does &lt;b style="mso-bidi-font-weight:normal;"&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;NOT&lt;/i&gt;&lt;/b&gt; refer to the &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Science"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;work of scientists&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;, but to work carried out by professionals, for which not creativity but predictability is the first criterion. Faced with the same task, a professional should consistently arrive at correct results. That doesn’t imply that he or she always &lt;b style="mso-bidi-font-weight:normal;"&gt;will&lt;/b&gt; get correct results, but if he or she doesn’t, then you can be sure that an error is made and that careful examination of the steps taken will reveal exactly what that error was. Examples of professionals include bakers, masons, pilots, etc. All people that you trust to deliver work of a consistent quality – you want your bread to taste the same each day, you want to be sure your home won’t collapse, and you expect to arrive safely whenever you embark a plane. And a regular restaurant cook is also supposed to cook the new meal the chef put on the menu exactly as the chef instructed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size:13.5pt;mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman"&gt;Data modeling: art or science?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Now that all the terms have been defined, it’s time to take a look at the question I started this blog post with – is data modeling an art or a science? And should it be?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;To start with the latter, I think it &lt;b style="mso-bidi-font-weight:normal;"&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;should&lt;/i&gt;&lt;/b&gt; be a science. If a customer pays a hefty sum of money to a professional data modeler to deliver a data model, then, assuming the customer did everything one can reasonably expect&lt;sup&gt;1&lt;/sup&gt; to answer questions from the data modeler, the customer can expect the data model to be correct&lt;sup&gt;2&lt;/sup&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 18pt;text-indent:-18pt;mso-list:l0 level1 lfo2;tab-stops:list 18.0pt;"&gt;&lt;font face="Times New Roman"&gt;&lt;sup&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;span style="mso-list:ignore;"&gt;&lt;font size="3"&gt;1&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/sup&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;I consider it &lt;i style="mso-bidi-font-style:normal;"&gt;reasonable&lt;/i&gt; to expect that the customer ensures that all relevant questions asked by the data modeler are answered, providing the data modeler asks these questions in a language and a jargon familiar to the customer and/or the employees he interviews. I do not consider it reasonable to expect the customer (or his employees) to learn language, jargon, or diagramming style used by data modelers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt 18pt;text-indent:-18pt;mso-list:l0 level1 lfo2;tab-stops:list 18.0pt;"&gt;&lt;font face="Times New Roman"&gt;&lt;sup&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;span style="mso-list:ignore;"&gt;&lt;font size="3"&gt;2&lt;/font&gt;&lt;span style="font:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/sup&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;A data model is &lt;i style="mso-bidi-font-style:normal;"&gt;correct&lt;/i&gt; if it allows any data collection that is allowed according to the business rules, and disallows any data collection that would violate any business rule.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Unfortunately, my ideas of what data modeling &lt;b style="mso-bidi-font-weight:normal;"&gt;&lt;i style="mso-bidi-font-style:normal;"&gt;should&lt;/i&gt;&lt;/b&gt; be like appear not to be on par with the current state of reality. One of the key factors I named for “science” is predictability. And to have a predictable outcome, a process must have a solid specification. As in, “if situation X arises, you need to ask the customer question Y; in case of answer Z, add &lt;i style="mso-bidi-font-style:normal;"&gt;this&lt;/i&gt; and remove &lt;i style="mso-bidi-font-style:normal;"&gt;that&lt;/i&gt; in the data model”. Unfortunately, such exactly specified process steps are absent in most (and in all commonly used!) data modeling methods. However, barring those rules, you have to rely on the inspiration of the data modeler – will he or she realize that question Y has to be asked? And if answer Z is given, will the modeler realize that &lt;i style="mso-bidi-font-style:normal;"&gt;this&lt;/i&gt; has to be added and &lt;i style="mso-bidi-font-style:normal;"&gt;that&lt;/i&gt; has to be removed? And if that doesn’t happen, then who’s to blame? The modeler, for doing everything the (incomplete) rules that do exist prescribe, but lacking the inspiration to see what was required here? Or should we blame ourselves, our industry, for allowing ourselves to have data modeling as art for several decades already, and still accepting this as “the way it is”?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;Many moons ago, when I was a youngster that had just landed a job as a &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/PL/I"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;PL/I&lt;/font&gt;&lt;/a&gt;&lt;font face="Times New Roman" size="3"&gt; programmer, I was sent to a course for &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Jackson_Structured_Programming"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;Jackson Structured Programming&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;. This is a method to build programs that process one or more inputs and produce one or more outputs. Though it can be used for interactive programs as well, it’s main strength is for batch programs, accessing sequential files. The course was great – though the students would not always arrive at the exact same design, each design would definitely be either correct, or incorrect. All correct designs would yield the same end result when executed against the same data. And for all incorrect designs, the teacher was able to pinpoint where in the process an error was made. For me, this course changed programming from art into science.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;A few years later, I was sent to a data modeling course. Most of the course focused on how to represent data models (some variation of ERM was used). We were taught how to represent the data model, but not how to find it. At the end, we were given a case study and asked to make a data model, which we would then present to the class. When we were done and the first model was presented, I noticed some severe differences from my model – differences that would result in different combinations of data being allowed or rejected. So when the teacher made some minor adjustments and then said that this was a good model, I expected to get a low note for my work. Then the second student had model that differed from both the first and my model – and again, the teacher mostly agreed to the choices made. This caused me to regain some of my confidence – and indeed, when it was my turn to present my, once again very different, model, I too was told that this was a very good one. So we were left with three models, all very different, and according to the instructor, they were all “correct” – and yet, data that would be allowed in the one would be rejected by the other. So &lt;i style="mso-bidi-font-style:normal;"&gt;this&lt;/i&gt; course taught me that data modeling was not science, but pure art.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;This was over a decade ago. But has anything changed in between? Well, maybe it has – but if so, it must have been when I was not paying attention, for I still do not see any mainstream data modeling method that does provide the modeler with a clear set of instructions on what to do in every case, or the auditor with a similar set of instructions to check whether the modeler did a great job, or screwed up.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size:13.5pt;mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman"&gt;Who’s to blame?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Another difference between art and science is the assignment of blame. If you buy a bread, have a house built, or embark on a plane, then you know who to blame if the bread is sour, if the house collapses, or if the plane lands on the wrong airport. But if you ask a painter to create a painting for your living and you don’t like the result, you can not tell him that he screwed up – because beauty is truly a matter of taste.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Have you ever been to a shop where all colors paint can be made by combining adequate amounts of a few base colors? Suppose you go to such a shop with a small sample of dyed wood, asking them to mix you the &lt;i style="mso-bidi-font-style:normal;"&gt;exact&lt;/i&gt; same color. The shopkeeper rummages through some catalogs, compares some samples, and then scribbles on a note: “2.98 liters white (#129683), 0.15 liters of cyan (#867324), and 0.05 liters of red (#533010)”. He then tells you that you have to sign the note before he can proceed to mix the paint. So you sign. And then, once the paint has been mixed, you see that it’s the wrong color – and the shop keepers then waves the signed slip of paper, telling you it’s “exactly according to the specification you signed off”, so you can’t get your money back. Silly, right?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;And yet, in almost every software project, there will be a moment when a data model is presented to the customer, usually in the form of an ERM diagram or a &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Unified_Modeling_Language"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;UML&lt;/font&gt;&lt;/a&gt;&lt;font face="Times New Roman" size="3"&gt; &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Class_diagram"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;class diagram&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;, and the customer is required to sign off for the project to continue. This is, with all respect, the same utter madness as the paint example. Let’s not forget that the customer is probably a specialist in his trade, be it banking, insurance, or selling ice cream, but not in reading ERM or UML diagrams. How is he supposed to check whether the diagram is an accurate representation of his business needs and business rules?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;The reason why data modelers require the customer to sign off the data model is, because they know that data modeling is not science but art. They know that the methods they use can’t guarantee correct results, even on correct inputs. So they require a signature on the data model, so that later, when nasty stuff starts hitting the fan, they can wave the signature in the customer’s face, telling him that he himself signed for the implemented model.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;In the paint shop, I’m sure that nobody would agree to sign the slip with the paint serial numbers. &lt;b style="mso-bidi-font-weight:normal;"&gt;I&lt;/b&gt; wouldn’t! I would agree, though, to place my signature on the sample I brought in, as that is a specification I can understand. Translating that to paint numbers and quantities is supposed to be the shopkeepers’ job, so let him take responsibility for that.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;So, I guess the real question is … why do customers still accept it when they are forced to sign for a model they are unable to understand? Why don’t they say that they will gladly sign for all the requirements they gave, and for all the answers they provided to questions that were asked in a language they understand, but that they insist on the data modeler taking responsibility for his part of the job?&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:12pt;font-family:'Times New Roman';mso-fareast-font-family:'Times New Roman';mso-ansi-language:en-us;mso-fareast-language:nl;mso-bidi-language:ar-sa;"&gt;Maybe the &lt;i style="mso-bidi-font-style:normal;"&gt;true&lt;/i&gt; art of data modeling is that data modelers are still able to get away with it…&lt;/span&gt;&lt;/p&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Data modeling: art or science?&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Data modeling: art or science?%0A%0Ahttp://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx" target="_blank" title = "Email Data modeling: art or science?"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx&amp;amp;title=Data+modeling%3a+art+or+science%3f" target="_blank" title = "Submit Data modeling: art or science? to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx&amp;amp;phase=2" target="_blank" title = "Submit Data modeling: art or science? to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx&amp;amp;title=Data+modeling%3a+art+or+science%3f" target="_blank" title = "Submit Data modeling: art or science? to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx&amp;amp;title=Data+modeling%3a+art+or+science%3f" target="_blank" title = "Submit Data modeling: art or science? to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/data-modeling-art-or-science.aspx&amp;amp;title=Data+modeling%3a+art+or+science%3f&amp;amp;;top=1" target="_blank" title = "Add Data modeling: art or science? to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=8173" width="1" height="1"&gt;</content><author><name>Hugo Kornelis</name><uri>http://sqlblog.com/members/Hugo+Kornelis.aspx</uri></author><category term="Database design" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/Database+design/default.aspx" /><category term="Data modeling" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/Data+modeling/default.aspx" /></entry><entry><title>[OT] Alive and kicking</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx" /><id>http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx</id><published>2008-08-02T22:01:30Z</published><updated>2008-08-02T22:01:30Z</updated><content type="html">&lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Wow! Would you believe that it’s almost five months since my last blog post? How time flies.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;No, I have not forgotten about you. I know you’ve all been faithfully checking the site (or your feed) each day, maybe even each hour, to get my next post. What can I say? I’m sorry for keeping you waiting so long.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman" size="3"&gt;The truth is, that I have been very, very busy. Lots of time has been spent on work (for without work, there will be no salary and hence no way to feed the family) and family (for why bother working hard to feed them if I can’t enjoy my time with them). And out of the remaining spare time, large chunks have been allocated to tech editing the next edition of &lt;/font&gt;&lt;a href="http://sqlblog.com/blogs/paul_nielsen/"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;Paul Nielsen&lt;/font&gt;&lt;/a&gt;&lt;font face="Times New Roman" size="3"&gt;’s &lt;/font&gt;&lt;a href="http://www.sqlserverbible.com/"&gt;&lt;font face="Times New Roman" color="#800080" size="3"&gt;SQL Server Bible&lt;/font&gt;&lt;/a&gt;&lt;font face="Times New Roman" size="3"&gt;. And apart from that, there are also a few hobby’s and interests that have nothing to do with SQL Server and that I will therefore not share with you &lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span style="font-family:wingdings;mso-ansi-language:en-us;mso-ascii-font-family:'Times New Roman';mso-hansi-font-family:'Times New Roman';mso-char-type:symbol;mso-symbol-font-family:wingdings;"&gt;&lt;span style="mso-char-type:symbol;mso-symbol-font-family:wingdings;"&gt;J&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font face="Times New Roman"&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin:0cm 0cm 0pt;"&gt;&lt;span style="mso-ansi-language:en-us;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;I hope to be able to post a bit more in the future. I plan to publish some of my thoughts on database design. But I have not forgotten about the unfinished “bin packing” series I started late last year – at least two more installments are planned there. And apart from that, I have various ideas and snippets collected. So if time permits, you can expect to see a bit more from me in the future.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=[OT] Alive and kicking&amp;amp;body=Seen on SQLblog.com: %0A%0A%09[OT] Alive and kicking%0A%0Ahttp://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx" target="_blank" title = "Email [OT] Alive and kicking"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx&amp;amp;title=%5bOT%5d+Alive+and+kicking" target="_blank" title = "Submit [OT] Alive and kicking to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx&amp;amp;phase=2" target="_blank" title = "Submit [OT] Alive and kicking to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx&amp;amp;title=%5bOT%5d+Alive+and+kicking" target="_blank" title = "Submit [OT] Alive and kicking to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx&amp;amp;title=%5bOT%5d+Alive+and+kicking" target="_blank" title = "Submit [OT] Alive and kicking to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/08/03/ot-alive-and-kicking.aspx&amp;amp;title=%5bOT%5d+Alive+and+kicking&amp;amp;;top=1" target="_blank" title = "Add [OT] Alive and kicking to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=8172" width="1" height="1"&gt;</content><author><name>Hugo Kornelis</name><uri>http://sqlblog.com/members/Hugo+Kornelis.aspx</uri></author><category term="Personal" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/Personal/default.aspx" /></entry><entry><title>Let's deprecate UPDATE FROM!</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx" /><id>http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx</id><published>2008-03-09T23:38:00Z</published><updated>2008-03-09T23:38:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;I guess that many people using UPDATE … FROM on a daily basis do so without being aware that they are violating all SQL standards.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;All versions of the ANSI SQL standard that I checked agree that an UPDATE statement has three clauses – the UPDATE clause, naming the table to be updated; the SET clause, specifying the columns to change and their new values; and the optional WHERE clause to filter the rows to be updated. No FROM or JOIN – if you need data from a different table, use a subquery in the SET clause. The optional FROM and JOIN clauses were added by Microsoft, as an extension to the standard syntax (and just to make out lives more interesting, they invented different variations of the syntax for SQL Server and for Access). So when you are in the habit of using them, be prepared to review all your UPDATE statements when moving to Oracle, DB2, Sybase, MySQL, or even a different Microsoft database!&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE:13.5pt;mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman"&gt;Standards? Bah, who cares?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Well, some do. Me for instance – I will never use proprietary syntax if I know a standard alternative, expect if using the latter has severe negative consequences. And maybe you will, one day, when your boss comes back from the golf course with the great news that he managed to convince a colleague (who just happens to work in an Oracle shop) to buy a copy of your company’s application instead of some off-the-shelf product. Or when there’s a great job opportunity for someone with cross platform skills. Or when you are asked to help out this new colleague with 10+ years of DB2 experience. One of the lesser known side effects of Murphy’s Law is that those who least expect having to move their database to another platform, will.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;But even if you really don’t care about portability, there are other reasons to be wary of using UPDATE FROM. In fact, the most important reason why I dislike UPDATE FROM is not that it’s non-standard, but that it is just too easy to make mistakes with. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE:13.5pt;mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman"&gt;Correctness? Bah, who cares?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Well, most do. That’s why we test.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;If I mess up the join criteria in a SELECT query so that too many rows from the second table match, I’ll see it as soon as I test, because I get more rows back then expected. If I mess up the subquery criteria in an ANSI standard UPDATE query in a similar way, I see it even sooner, because SQL Server will return an error if the subquery returns more than a single value. But with the proprietary UPDATE FROM syntax, I can mess up the join and never notice – SQL Server will happily update the same row over and over again if it matches more than one row in the joined table, with only the result of the last of those updates sticking. And there is no way of knowing which row that will be, since that depends in the query execution plan that happens to be chosen. A worst case scenario would be one where the execution plan just happens to result in the expected outcome during all tests on the single-processor development server – and then, after deployment to the four-way dual-core production server, our precious data suddenly hits the fan…&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE:13.5pt;mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman"&gt;That’s all?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Well, almost. There’s one more thing. Probably not something you’ll run into on a daily base, but good to know nonetheless. If the target of the update happens to be a view instead of a base table, and there is an INSTEAD OF UPDATE trigger defined for the view, the UPDATE will fail with this error message:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:8pt;COLOR:red;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;Msg 414, Level 16, State 1, Line 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:8pt;COLOR:red;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;UPDATE is not allowed because the statement updates view "v1" which participates in a join and has an INSTEAD OF UPDATE trigger.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Of course, most people will never run into this. But I did have the misfortune of doing so once – unfortunately, I discovered this limitation &lt;I style="mso-bidi-font-style:normal;"&gt;after&lt;/I&gt; rewriting several hundred ANSI standard UPDATE statements to the equivalent UPDATE FROM, and having to convert them all back after as much as a single test…&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE:13.5pt;mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman"&gt;And that’s why you want to deprecate UPDATE FROM?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Well, no. The view with INSTEAD OF UPDATE trigger won’t affect many people. And the possibility of error can be somewhat thwarted by making sure (and double-checking) to always include all columns of the primary key (or a unique constraint) of the source table. So we’re back to the more principle point of avoiding proprietary syntax if there is an ANSI standard alternative with no or limited negative consequences. And in the case of UPDATE FROM, there are some cases where the standard syntax just doesn’t cut it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;One such scenario is when a file is read in periodically with updated information that has to be pushed into the main table. The code below sets up a simplified example of this – a table Customers, with SSN as its primary key, that stores address and lots of other information, and a table Moved, which is the staging table containing the contents of a file received from a third party listing new address for people who recently moved. I have also included the code to preload the tables with some mocked up data – the Customers table has 10,000 rows, and the Moved table has 3,000 rows, 1,000 of which match an existing row in the Customers table. The others don’t – those people are apparently not our customers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;CREATE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;TABLE&lt;/SPAN&gt; Customers&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SSN &lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;9&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Street &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;40&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HouseNo &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;City &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;40&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;LotsOfOtherInfo &lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;250&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;DEFAULT &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:red;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;PRIMARY&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;KEY &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CHECK &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;LIKE&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'%[^0-9]%'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;CREATE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;TABLE&lt;/SPAN&gt; Moved&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SSN &lt;SPAN style="COLOR:blue;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;9&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Street &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;40&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HouseNo &lt;SPAN style="COLOR:blue;"&gt;int&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;City &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;40&lt;SPAN style="COLOR:gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;PRIMARY&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;KEY &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;CHECK &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;LIKE&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'%[^0-9]%'&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;go&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;INSERT&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;INTO&lt;/SPAN&gt; Customers&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; Street&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; HouseNo&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; City&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:gray;"&gt;RIGHT(&lt;/SPAN&gt;Number&lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt;1000000000&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;9&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'Street '&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;CAST&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;Number &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;10&lt;SPAN style="COLOR:gray;"&gt;)),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Number&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'City '&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;CAST&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;Number &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;10&lt;SPAN style="COLOR:gray;"&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;dbo&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Numbers&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;Number &lt;SPAN style="COLOR:gray;"&gt;BETWEEN&lt;/SPAN&gt; 1 &lt;SPAN style="COLOR:gray;"&gt;AND&lt;/SPAN&gt; 30000&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Number &lt;SPAN style="COLOR:gray;"&gt;%&lt;/SPAN&gt; 3 &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; 0&lt;SPAN style="COLOR:gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;INSERT&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;INTO&lt;/SPAN&gt; Moved&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; Street&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; HouseNo&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; City&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:gray;"&gt;RIGHT(&lt;/SPAN&gt;Number&lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt;1000000000&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt;9&lt;SPAN style="COLOR:gray;"&gt;),&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'&lt;st1:address&gt;New street&lt;/st1:address&gt; '&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;CAST&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;Number &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;10&lt;SPAN style="COLOR:gray;"&gt;)),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Number &lt;SPAN style="COLOR:gray;"&gt;*&lt;/SPAN&gt; 2&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="COLOR:red;"&gt;'New city '&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;+&lt;/SPAN&gt; &lt;SPAN style="COLOR:fuchsia;"&gt;CAST&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;Number &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; &lt;SPAN style="COLOR:blue;"&gt;varchar&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;10&lt;SPAN style="COLOR:gray;"&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;dbo&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Numbers&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;Number &lt;SPAN style="COLOR:gray;"&gt;BETWEEN&lt;/SPAN&gt; 1 &lt;SPAN style="COLOR:gray;"&gt;AND&lt;/SPAN&gt; 30000&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Number &lt;SPAN style="COLOR:gray;"&gt;%&lt;/SPAN&gt; 10 &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; 0&lt;SPAN style="COLOR:gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;go&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Since ANSI-standard SQL does not allow a join to be used in the UPDATE statement, we’ll have to use subqueries to find the new information, &lt;B style="mso-bidi-font-weight:normal;"&gt;and&lt;/B&gt; to find the rows that need to be updated, resulting in this query:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;UPDATE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; Customers&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Street&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;st1:address&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&lt;/SPAN&gt; Street&lt;/st1:address&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Moved &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; Customers&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HouseNo &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&lt;/SPAN&gt; HouseNo&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Moved &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; Customers&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;City&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&lt;/SPAN&gt; City&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Moved &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; Customers&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:gray;"&gt;EXISTS&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Moved &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; Customers&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;There’s a lot of duplicated code in here. And if we were getting data from a complicated subquery instead of the table Moved, it would be even worse (though we can at least put all the duplicated code in a CTE since SQL Server 2005). Of course, writing the code is done quickly enough once you master the use of copy and paste, but the code has to be maintained as well.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Maybe even worse is that the performance of this query just sucks – if you run this (enclosed in a BEGIN TRAN / ROLLBACK TRAN, so you can run the variations below without having to rebuild the original data) and check out the execution plan, you’ll see that the optimizer needs no less than five table scans (one for Customers, and four for Moved) and four merge join operators. And that, too, would be much worse if the source of the data had been a complex subquery (and no, using a CTE will not help the optimizer find a better plan – it just doesn’t understand that the four subqueries are similar enough that they can be collapsed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Now, if Microsoft had chosen to implement row-value constructors (as defined in the ANSI standard), we could have simplified this to&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;UPDATE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; Customers&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SET&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;Street&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; HouseNo&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; City&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;st1:address&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&lt;/SPAN&gt; Street&lt;/st1:address&gt;&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; HouseNo&lt;SPAN style="COLOR:gray;"&gt;,&lt;/SPAN&gt; City&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Moved &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; Customers&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:gray;"&gt;EXISTS&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN style="COLOR:gray;"&gt;*&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Moved &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN &lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; Customers&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;But this is invalid syntax in any version of SQL Server (including the latest CTP for SQL Server 2008), and I know of no plans to change that before SQL Server 2008 RTMs.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;But with using the proprietary UPDATE FROM syntax, we can simplify this, and get a much better performance to boot. Here’s how the same update is written in non-portable code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;UPDATE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;c&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Street&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Street&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HouseNo&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;HouseNo&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;City&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;City&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Customers &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; c&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;INNER&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:gray;"&gt;JOIN&lt;/SPAN&gt; Moved&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ON&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; c&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="COLOR:gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;And now, the optimizer will produce a plan that scans each table only once and has only a single merge join operator. Some quick tests (with much more rows in the tables) show that it executes two to three times quicker than the ANSI standard version. For that performance gain, I will gladly choose the proprietary syntax over the standard!&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE:13.5pt;mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman"&gt;What’s with the title of this post then? Why deprecate a fine feature?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Patience, we’re getting there. Bear with me.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;All the above is true for versions of SQL Server up to SQL Server 2005. But SQL Server 2008 will change the playing field. It introduces a new statement, MERGE, that is specifically designed for situations where rows from a table source either have to be inserted into a destination table, or have to be used to update existing rows in the destination table. However, there is no law that prescribes that any MERGE should always actually include both an insert and an update clause – so with this new statement, we can now rewrite the above code as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;MERGE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;INTO&lt;/SPAN&gt; Customers &lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; c&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;USING&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Moved&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;AS&lt;/SPAN&gt; m&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:blue;"&gt;ON&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; c&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;SSN&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;WHEN&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:gray;"&gt;MATCHED&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt; &lt;SPAN style="COLOR:blue;"&gt;UPDATE&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Street&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;Street&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;HouseNo&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;HouseNo&lt;SPAN style="COLOR:gray;"&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;City&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR:gray;"&gt;=&lt;/SPAN&gt; m&lt;SPAN style="COLOR:gray;"&gt;.&lt;/SPAN&gt;City&lt;SPAN style="COLOR:gray;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;As you can see, the source table and the join criteria are included only once, just as in the proprietary UPDATE FROM. The execution plan (tested on the February CTP, also known as CTP6) is also quite similar, including just a few extra operators that are specific to the new MERGE statement. What really surprised me, was that the plan for the MERGE statement was estimated to be about 65% cheaper (faster) than the corresponding UPDATE FROM statement. However, I think SQL Server is lying here – a quick test with more data shows only an extremely marginal advantage of MERGE over UPDATE FROM. This test was too limited to draw serious conclusions, but I am quite sure that there will not be a 65% saving by using MERGE over UPDATE FROM. (I do expect such a saving form either MERGE or UPDATE FROM over the ANSI-compliant UPDATE statement for this case).&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;The good news is that:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;TEXT-INDENT:-18pt;mso-list:l0 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;SPAN style="mso-list:ignore;"&gt;&lt;FONT size=3&gt;1)&lt;/FONT&gt;&lt;SPAN style="FONT:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;The MERGE statement is described in SQL:2003 and can thus be considered ANSI standard. (In fact, SQL Server implements a superset of the ANSI standard MERGE syntax: everything described in the syntax is implemented, but there are some non-standard extensions that make the command even more useful as well. However, the example above uses only the standard features and should hence run on each DBMS that conforms to the SQL:2003 version of MERGE).&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;TEXT-INDENT:-18pt;mso-list:l0 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;SPAN style="mso-list:ignore;"&gt;&lt;FONT size=3&gt;2)&lt;/FONT&gt;&lt;SPAN style="FONT:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;The MERGE statement will return an error message if I mess up my join criteria so that more than a single row from the source is matched:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:8pt;COLOR:red;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;Msg 8672, Level 16, State 1, Line 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:8pt;COLOR:red;FONT-FAMILY:'Courier New';mso-ansi-language:en-us;mso-fareast-language:en-us;mso-no-proof:yes;"&gt;The MERGE statement attempted to UPDATE or DELETE the same row more than once. This happens when a target row matches more than one source row. A MERGE statement cannot UPDATE/DELETE the same row of the target table multiple times. Refine the ON clause to ensure a target row matches at most one source row, or use the GROUP BY clause to group the source rows.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt 36pt;TEXT-INDENT:-18pt;mso-list:l0 level1 lfo1;tab-stops:list 36.0pt;"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;SPAN style="mso-list:ignore;"&gt;&lt;FONT size=3&gt;3)&lt;/FONT&gt;&lt;SPAN style="FONT:7pt 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;The MERGE statement will gladly accept a view with an INSTEAD OF UPDATE trigger as the target of the update.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;So as you see, MERGE allows me to achieve what I previously could achieve only with an ANSI standard UPDATE statement with lots of duplicated code and lousy performance, or with a UPDATE FROM statement that hinders portability, introduces a higher than normal risk of errors going unnoticed through QA right into the production database, and has some odd limitation on views with INSTEAD OF UPDATE triggers. None of these downsides and limitations apply to MERGE. And if there are any other problems with MERGE, I have yet to find them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman';mso-ansi-language:en-us;mso-fareast-language:nl;mso-fareast-font-family:'Times New Roman';mso-bidi-language:ar-sa;"&gt;With this alternative available, I fail to see any reason why the proprietary UPDATE FROM syntax should be maintained. In my opinion, it can safely be marked as deprecated in SQL Server 2008. It should of course still work, as “normal” supported syntax in both SQL Server 2008 and the next version, and in at least one version more if the database is set to a lower compatibility – but it should be marked as deprecated, and it should eventually be removed from the product. Why waste resources on maintaining that functionality, when there is an alternative that is better in every conceivable way? I’d much rather see the SQL Server team spend their time and energy on more important stuff, such as full support for row-value constructors and full support for the OVER() clause. Or maybe even on releasing Service Pack 3 for SQL Server 2005!&lt;/SPAN&gt;&lt;/P&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Let's deprecate UPDATE FROM!&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Let's deprecate UPDATE FROM!%0A%0Ahttp://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx" target="_blank" title = "Email Let's deprecate UPDATE FROM!"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx&amp;amp;title=Let%27s+deprecate+UPDATE+FROM!" target="_blank" title = "Submit Let's deprecate UPDATE FROM! to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx&amp;amp;phase=2" target="_blank" title = "Submit Let's deprecate UPDATE FROM! to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx&amp;amp;title=Let%27s+deprecate+UPDATE+FROM!" target="_blank" title = "Submit Let's deprecate UPDATE FROM! to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx&amp;amp;title=Let%27s+deprecate+UPDATE+FROM!" target="_blank" title = "Submit Let's deprecate UPDATE FROM! to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx&amp;amp;title=Let%27s+deprecate+UPDATE+FROM!&amp;amp;;top=1" target="_blank" title = "Add Let's deprecate UPDATE FROM! to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=5515" width="1" height="1"&gt;</content><author><name>Hugo Kornelis</name><uri>http://sqlblog.com/members/Hugo+Kornelis.aspx</uri></author><category term="T-SQL" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/T-SQL/default.aspx" /><category term="Performance" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/Performance/default.aspx" /><category term="Best Practices" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/Best+Practices/default.aspx" /><category term="SQL Server 2008" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/SQL+Server+2008/default.aspx" /><category term="Standard vs proprietary" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/Standard+vs+proprietary/default.aspx" /></entry><entry><title>Want a Service Pack? Ask for it!</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx" /><id>http://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx</id><published>2008-02-01T20:19:00Z</published><updated>2008-02-01T20:19:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Service pack 2 for SQL Server 2005 is already 11 months old. And there is still no sign of service pack 3 on the horizon. Why is that? Has Microsoft managed to release a perfect, completely bug-free product? No, of course not – with the size and complexity of a product such as SQL Server is, that will simply never happen.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT face="Times New Roman" size=3&gt;There have, in fact, enormous numbers of bugs been uncovered and fixed since SP2 was released. And roughly once every two months, a so-called “cumulative update package” gets released. The last one is officially called “Cumulative update package 5 for SQL Server 2005 Service Pack 2”, or simply CU5 for friends. Quite a mouthful. But if you think that &lt;I style="mso-bidi-font-style:normal;"&gt;name&lt;/I&gt; is long, &lt;/FONT&gt;&lt;A href="http://support.microsoft.com/kb/943656/"&gt;&lt;FONT face="Times New Roman" color=#800080 size=3&gt;check out&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt; the list of bugs that CU5 fixes!&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;I think that it’s great that Microsoft now releases these cumulative update packages at regular intervals. I see them as a good addition that nicely fits in between hot-fixes for quick fixes with limited testing, only for those needing it, on one side, and fully tested service packs that are released once or at most twice per year on the other side.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Given the long list of bugs fixed in CU5, should everyone be recommended to install it, just as if it were a service pack? Well, no. Microsoft themselves advise against this. In fact, you can’t even just download and install the package; you have to “&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:arial;mso-ansi-language:en-gb;"&gt;submit a request to Microsoft Online Customer Services to obtain the cumulative update package&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;”. This quote comes directly from the Knowledge Base article for CU5, as come these further disclaimers:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;TEXT-INDENT:35.4pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;“&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:arial;mso-ansi-language:en-gb;"&gt;it is intended to correct only the problems that are described in this article. Apply it only to systems that are experiencing these specific problems&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;”&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;TEXT-INDENT:35.4pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;“&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:arial;mso-ansi-language:en-gb;"&gt;if you are not severely affected by any of these problems, we recommend that you wait for the next SQL Server 2005 service pack that contains the hotfixes in this cumulative update package&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;”&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;These quotes, which have been in the same or a similar form in all cumulative updates, make it pretty clear that I should wait for the next service pack. So we waited. And waited. And waited some more. And then, some MVP's got impatient and suggested (in the MVP newsgroup) to release SP3 as soon as possible. The answer surprised me – apparently, Microsoft has no plans yet to release a new service pack, because not enough customers have asked for it. (MS: “&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:11pt;COLOR:red;FONT-FAMILY:'Comic Sans MS';mso-ansi-language:en-gb;"&gt;Good, but honestly, at least our management says, we're not getting feedback requesting SP3 from enough customers to require it&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;” – Me: “&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:11pt;FONT-FAMILY:'Comic Sans MS';mso-ansi-language:en-gb;"&gt;Is that reason under NDA? Because if it's not, I can post a blog entry supporting people to write MS management asking for SP3&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;” – MS: “&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:11pt;COLOR:red;FONT-FAMILY:'Comic Sans MS';mso-ansi-language:en-gb;"&gt;As far as I know that's a public response&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;”). So, the KB article says to wait, all customers do as asked and then Microsoft concludes that nobody wants a service pack because nobody asks for it? And I misunderstood when I thought that “&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:arial;mso-ansi-language:en-gb;"&gt;any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;” implies that there will actually &lt;I style="mso-bidi-font-style:normal;"&gt;be&lt;/I&gt; a next service pack. Apparently, my graps of the English language is not as good as I’d like to believe…&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT face="Times New Roman" size=3&gt;Anyway, I now understand that Microsoft will only release a new service pack if enough people ask for it. So I’ve decided to make sure that they get the message. I’ve gone to Connect and filed a &lt;/FONT&gt;&lt;A class="" href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=326575"&gt;&lt;FONT face="Times New Roman" color=#0000ff size=3&gt;suggestion to release Service Pack for SQL Server 2005, including all changes up to and including CU5&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;If you read this, and you agree with me that Service Pack 3 for SQL Server 2005 is overdue, you now know what to do – log in to Connect and vote 5 for my suggestion. And if you think that I’m losing my marbles and that there should be no Service Pack 3, then you should log in to Connect and vote 1. In short: make yourself heard!&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Microsoft will not release service pack 3 because insufficient customer are asking for it? Well, I’m asking – can we have service pack 3, please? Pretty please? Pretty pretty pretty pretty pretty please????&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-gb;"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE:12pt;FONT-FAMILY:'Times New Roman';mso-ansi-language:en-gb;mso-fareast-font-family:'Times New Roman';mso-fareast-language:nl;mso-bidi-language:ar-sa;"&gt;With sugar on top…&lt;/SPAN&gt;
&lt;BR&gt;&lt;div class = "shareblock"&gt;&lt;span class = "shareblockTitle"&gt;Share this post:&lt;/span&gt;&lt;span class = "shareblockLink"&gt; &lt;a href = "mailto:?subject=Want a Service Pack? Ask for it!&amp;amp;body=Seen on SQLblog.com: %0A%0A%09Want a Service Pack? Ask for it!%0A%0Ahttp://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx" target="_blank" title = "Email Want a Service Pack? Ask for it!"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx&amp;amp;title=Want+a+Service+Pack%3f+Ask+for+it!" target="_blank" title = "Submit Want a Service Pack? Ask for it! to del.icio.us"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx&amp;amp;phase=2" target="_blank" title = "Submit Want a Service Pack? Ask for it! to digg.com"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx&amp;amp;title=Want+a+Service+Pack%3f+Ask+for+it!" target="_blank" title = "Submit Want a Service Pack? Ask for it! to reddit.com"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx&amp;amp;title=Want+a+Service+Pack%3f+Ask+for+it!" target="_blank" title = "Submit Want a Service Pack? Ask for it! to DotNetKicks"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://sqlblog.com/blogs/hugo_kornelis/archive/2008/02/01/want-a-service-pack-ask-for-it.aspx&amp;amp;title=Want+a+Service+Pack%3f+Ask+for+it!&amp;amp;;top=1" target="_blank" title = "Add Want a Service Pack? Ask for it! to Live Bookmarks"&gt;live it!&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://info.sqlblog.com/a.aspx?ZoneID=0&amp;BannerID=12&amp;AdvertiserID=1&amp;CampaignID=12&amp;Task=Get&amp;Mode=TEXT&amp;SiteID=1&amp;RandomNumber=463323" width="1" height="1" border="0"&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=4827" width="1" height="1"&gt;</content><author><name>Hugo Kornelis</name><uri>http://sqlblog.com/members/Hugo+Kornelis.aspx</uri></author><category term="SQL Server 2005" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/SQL+Server+2005/default.aspx" /><category term="Support" scheme="http://sqlblog.com/blogs/hugo_kornelis/archive/tags/Support/default.aspx" /></entry><entry><title>Bin packing part 3: Need for speed</title><link rel="alternate" type="text/html" href="http://sqlblog.com/blogs/hugo_kornelis/archive/2008/01/12/bin-packing-part-3-need-for-speed.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="4059" href="http://sqlblog.com/blogs/hugo_kornelis/attachment/4502.ashx" /><id>http://sqlblog.com/blogs/hugo_kornelis/archive/2008/01/12/bin-packing-part-3-need-for-speed.aspx</id><published>2008-01-11T22:24:00Z</published><updated>2008-01-11T22:24:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN:0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-ansi-language:en-us;"&