<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>Dan Guzman's Blog</title>
    <link rel="self" type="application/xml" href="http://weblogs.sqlteam.com/dang/Atom.aspx" />
    <subtitle type="html" />
    <id>http://weblogs.sqlteam.com/dang/Default.aspx</id>
    <author>
        <name>Dan Guzman</name>
        <uri>http://weblogs.sqlteam.com/dang/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 1.9.4.0">Subtext</generator>
    <updated>2008-08-30T18:58:07Z</updated>
    <entry>
        <title>Sliding Window Table Partitioning</title>
        <link rel="self" type="text/html" href="http://weblogs.sqlteam.com/dang/archive/2008/08/30/Sliding-Window-Table-Partitioning.aspx" />
        <id>http://weblogs.sqlteam.com/dang/archive/2008/08/30/Sliding-Window-Table-Partitioning.aspx</id>
        <published>2008-08-30T18:58:07-05:00:00</published>
        <updated>2008-08-30T18:58:07Z</updated>
        <content type="html">&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;span style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; mso-bidi-font-size: 10.0pt"&gt;&lt;font face="Calibri"&gt;SQL Server table partitioning provides a great way to manage a time-based sliding window.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;By mapping each time period to an individual partition, old data can be efficiently purged or archived using a nearly instantaneous switch out of an entire partition.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;However, there are a couple of aspects of a time-base sliding window strategy that require some thought and planning. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong&gt;&lt;span style="FONT-SIZE: 13pt; COLOR: #17365d; mso-bidi-font-size: 16.0pt"&gt;&lt;font face="Calibri"&gt;RANGE LEFT or RIGHT&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;span style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; mso-bidi-font-size: 10.0pt"&gt;&lt;font face="Calibri"&gt;The RANGE LEFT or RIGHT partition function specification indicates which partition includes the exact match on the partition boundary.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;It is especially important to consider both the RANGE specification and boundary value when the partition function data type includes a time component (smalldatetime, datetime, datatime2 and datetimeoffset) because one usually wants all data for a given date in the same partition.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;span style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; mso-bidi-font-size: 10.0pt"&gt;&lt;font face="Calibri"&gt;In the case of a RANGE LEFT, specify the latest time allowable for the data type and beware of implicit rounding.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For example, a boundary value of ‘2008-08-30T23:59:59.999’ for a datetime partition function will get rounded up to ‘2008-08-31T00:00:00.000’ and result in data for midnight 2008-08-31 getting inserted into the right partition instead of the left.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;To avoid this rounding issue, specify ‘2008-08-30T23:59:59.997’ instead.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;span style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; mso-bidi-font-size: 10.0pt"&gt;&lt;font face="Calibri"&gt;The following table shows examples that ensure ‘2008-08-31T00:00:00’ always ends up in the LEFT partition.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The datetimeoffset examples assume UTC time zone (+00:00) is the desired date boundary but this can be adjusted as desired.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid black .5pt; mso-yfti-tbllook: 1184" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Partition Function Datatype&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Range LEFT Boundary Specification&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 1; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;smalldatetime&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 2; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.997’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 3; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(0)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 4; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(1)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 5; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(2)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.99’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 6; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(3)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.999’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 7; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(4)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9999’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 8; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(5)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.99999’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 9; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(6)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.999999’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 10; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2(7)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9999999’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 11; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetime2&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9999999’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 12; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(0)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 13; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(1)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 14; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(2)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.99+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 15; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(3)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.999+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 16; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(4)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9999+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 17; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(5)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.99999+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 18; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(6)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.999999+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 19; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset(7)&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9999999+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="HEIGHT: 0.1in; mso-yfti-irow: 20; mso-yfti-lastrow: yes; mso-height-rule: exactly"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;datetimeoffset&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; HEIGHT: 0.1in; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt; mso-height-rule: exactly" valign="top"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;‘2008-08-30T23:59:59.9999999+00:00’&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;span style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; mso-bidi-font-size: 10.0pt"&gt;&lt;font face="Calibri"&gt;With a RANGE RIGHT partition function, specify only the desired date (or specify date with time of midnight).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This will ensure that all data for the specified date is in the same partition.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;span style="FONT-WEIGHT: normal; FONT-SIZE: 11pt; COLOR: windowtext; mso-bidi-font-size: 10.0pt"&gt;&lt;o:p&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong&gt;&lt;span style="FONT-SIZE: 13pt; COLOR: #17365d; mso-bidi-font-size: 16.0pt"&gt;&lt;font face="Calibri"&gt;Avoid Data movement with SPLIT and MERGE&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: 0in 0in 10pt"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="FONT-SIZE: 11pt; FONT-FAMILY: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.0pt; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;SPLIT and MERGE is very fast when the partitions are empty because no data movement is necessary.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The goal is to plan sliding window partition maintenance accordingly.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;After the start of a new period, SWITCH out old data and remove the vacated empty partition with MERGE.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;SPLIT the last partition (empty) in anticipation of future data. &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;The choice of a RANGE LEFT or RIGHT partition also affects how one uses SWITCH, SPLIT and MERGE to maintain the sliding window.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong&gt;&lt;span style="FONT-SIZE: 13pt; COLOR: #17365d; mso-bidi-font-size: 16.0pt"&gt;&lt;font face="Calibri"&gt;Sliding a LEFT Partition Function Window&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;At the start of a new period with a LEFT partition function, partition 1 contains the old data, the second from last partition contains the current data and then last partition (empty) is for future data.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The partition can be maintained as follows:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;1) SWITCH out partition 1 to a staging table for archive/purge&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;2) MERGE empty partition 1 with non-empty partition 2 to form a new partition 1 (with data)&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;3) SPLIT last partition so that the last 2 partitions are now empty&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;4) Repeat steps 1 through 3 after the start of the next period&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong&gt;&lt;span style="FONT-SIZE: 13pt; COLOR: #17365d; mso-bidi-font-size: 16.0pt"&gt;&lt;font face="Calibri"&gt;Sliding a RIGHT Partition Function Window&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;The RIGHT partition maintenance strategy is slightly different that the LEFT strategy.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The difference is that partition 2 rather than partition 1 contains the old data at the start of a new period.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;However, just like the LEFT strategy, the second from last partition contains the current data and then last partition (empty) is for future data.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The partition can be maintained as follows:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;1) SWITCH out partition 2 to a staging table for archive/purge&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;2) MERGE empty partition 1 with empty partition 2 to form a new partition 1 (empty)&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;3) SPLIT last partition so the last 2 partitions are now empty&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;4) Repeat steps 1 through 3 after the start of the next period&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong&gt;&lt;span style="FONT-SIZE: 13pt; COLOR: #17365d; mso-bidi-font-size: 16.0pt"&gt;&lt;font face="Calibri"&gt;Automating the Sliding Window Maintenance&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: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;In my next post, I’ll share a script that will help automate sliding window maintenance. &lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.sqlteam.com/dang/aggbug/60703.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://weblogs.sqlteam.com/dang/comments/60703.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://weblogs.sqlteam.com/dang/comments/commentRss/60703.aspx</wfw:commentRss>
        <trackback:ping>http://weblogs.sqlteam.com/dang/services/trackbacks/60703.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Are you a DBA Monkey?</title>
        <link rel="self" type="text/html" href="http://weblogs.sqlteam.com/dang/archive/2008/08/01/Are-you-a-DBA-Monkey.aspx" />
        <id>http://weblogs.sqlteam.com/dang/archive/2008/08/01/Are-you-a-DBA-Monkey.aspx</id>
        <published>2008-08-01T17:56:28-05:00:00</published>
        <updated>2008-08-03T09:51:53Z</updated>
        <content type="html">&lt;div style="MARGIN: 0in 0in 10pt"&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;We have a number of de facto standards in our shop, such as always placing data and indexes on separate filegroups. I asked why we bothered with the separate filegroups since the underlying files were often on the same physical disks anyway. No one really knew why. The practice had been followed before the current DBAs joined the organization and has continued.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;This reminded me of a parable my boss told me several years ago. Five monkeys are placed in a cage with a step ladder leading to a bunch of bananas suspended from the top. The first monkey rushes up the ladder eagerly only to get forcibly knocked off by a stream of water from fire hose when he reaches the top. The other monkeys are also drenched with the ice cold water.   After recovering from the shock, another monkey climbs the ladder with the same result. Eventually, each monkey tries to reach the bananas and learns the futility and unpleasantness of the effort.  Any monkey that even tries to climb the ladder is promptly tackled by his peers.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Now attrition begins. One of the original monkeys is removed and replaced with a new monkey. He looks at the bananas and back at the other monkeys, wondering why they ignore such a tasty treat. He starts up the ladder and is immediately pulled off and beaten by the other monkeys. After a couple of attempts, the new monkey learns to avoid the ladder. Another original monkey is replaced with a new monkey. When he goes for the bananas, he also gets tackled by the other monkeys, including the one that’s never been soaked. The same process is repeated; original monkeys are replaced and new monkeys quickly learn to avoid the ladder despite the prize at the top. The last original monkey is eventually replaced.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;We now have a group of monkeys who’ve never been soaked by the fire hose, won’t climb the ladder and won’t allow others to climb it either.  It doesn’t matter if the fire hose is removed or how many generations of monkeys follow. They don’t know why they do what they do.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Like the monkeys, &lt;a href="http://en.wikipedia.org/wiki/Institutional_memory"&gt;institutional memory&lt;/a&gt; causes us to follow practices mindlessly and be slow to adapt to changes in our environment. Going back to my data/index filegroup question, there may have once been a good reason for the separate filegroups. Perhaps the separate groups improved performance of a specific application workload by isolating random and sequential I/O on local disk storage. Our current environment is quite different, however. Physical disks on the current SAN storage are often shared with other hosts/LUNs so placing data and indexes on different filegroups no longer isolates the I/O. Furthermore, the separate filegroup approach was since generalized to apply to all databases regardless of whether or not it made sense for a given application workload. We continue the data/index filegroup practice because the reasoning behind the separate filegroups is not known or understood. &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;It may be easier to robotically continue with the status quo but I think we need to understand exactly why a given filegroup approach might be advantageous so that we can choose what is best for the situation at hand.  For example, I/O Performance of our high transaction OLTP databases is best achieved by balancing the heavy random I/O workload over as many disks as possible because this maximizes the disk transfers/sec rate.  I don't think segregating data and index files is appropriate for our OLTP applications because it artificially caps the maximum I/O rate and can actually introduce an unnecessary I/O bottleneck. &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;In contrast, a single filegroup for both data and indexes distributes I/O proportionally according to the size of the underlying files with less complexity and administration than the separate filegroup approach. In my experience, this single user-defined filegroup strategy works well for both OLTP and mixed workloads where sequential I/O cannot be accurately predicted. Note that we need to work closely with the SAN storage team to meet performance objectives regardless of the filegroup strategy we choose since the physical implementation is outside our control.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;We also have databases containing large amounts of historical data. In that case, we can use filegroups to place infrequently accessed older data on read-only filegroups with the files on relatively slow inexpensive storage. Often-queried recent data can then be stored on the more expensive fast storage devices via a read-write filegroup. The key here is that the additional maintenance and administration complexity is justified by the hardware savings. Similarly, our large reporting databases can benefit from a customized filegroup strategy to facilitate backup/recovery or improve performance by isolating random and sequential I/O for specialized (and predictable) workloads. &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Like many of the choices we make, there is no single filegroup strategy that is optimal for all cases. It’s important to understand the rationale behind a given approach so that one can choose the best one for the current situation and create new strategies when needed. A key differentiator between average DBA and a good one is a thorough knowledge of why practices are followed. Don’t be a monkey.&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://weblogs.sqlteam.com/dang/aggbug/60665.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://weblogs.sqlteam.com/dang/comments/60665.aspx</wfw:comment>
        <slash:comments>3</slash:comments>
        <wfw:commentRss>http://weblogs.sqlteam.com/dang/comments/commentRss/60665.aspx</wfw:commentRss>
        <trackback:ping>http://weblogs.sqlteam.com/dang/services/trackbacks/60665.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Blocking is not Deadlocking</title>
        <link rel="self" type="text/html" href="http://weblogs.sqlteam.com/dang/archive/2008/07/26/Blocking-is-not-Deadlocking.aspx" />
        <id>http://weblogs.sqlteam.com/dang/archive/2008/07/26/Blocking-is-not-Deadlocking.aspx</id>
        <published>2008-07-26T10:41:32-05:00:00</published>
        <updated>2008-07-26T10:41:32Z</updated>
        <content type="html">&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;After interviewing several candidates for a database position, I was surprised to find that many didn’t know the difference between a block and deadlock.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Many used the terms interchangeably because they thought both were synonymous.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Although missing this interview question didn’t necessarily disqualify those candidates, it certainly didn’t help their chances.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I decided I’d contrast blocking and deadlocking here to help those who might not grasp the difference.&lt;/font&gt;&lt;/p&gt;
&lt;h1 style="MARGIN: 24pt 0in 0pt; LINE-HEIGHT: 115%; mso-pagination: widow-orphan lines-together"&gt;&lt;span style="FONT-SIZE: 14pt; COLOR: #365f91; LINE-HEIGHT: 115%; FONT-FAMILY: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: major-latin; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-theme-font: major-bidi; mso-themecolor: accent1; mso-themeshade: 191"&gt;Blocking&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; tab-stops: 648.65pt"&gt;&lt;font face="Calibri" size="3"&gt;Blocking is a necessary side effect of using locks to control concurrent resource access.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;A lock is either compatible or incompatible with other locks depending on the lock mode.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Before a lock is granted, SQL Server first checks to see if an incompatible lock on the same resource exists.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;If not, the lock request is granted and execution proceeds.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;When the requested lock mode is incompatible with an existing lock mode on the same resource, the requesting session is blocked and waits until:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: 648.65pt"&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri" size="3"&gt;1)&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The blocking session releases the lock&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: 648.65pt"&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri" size="3"&gt;2)&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The LOCK_TIMEOUT threshold of the blocked session is reached (indefinite by default)&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: 648.65pt"&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri" size="3"&gt;3)&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The blocked client cancels the query&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1; tab-stops: 648.65pt"&gt;&lt;span style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri" size="3"&gt;4)&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The blocked client times out (30-second default in ADO/ADO.NET, technically the same as #3)&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; tab-stops: 648.65pt"&gt;&lt;font face="Calibri" size="3"&gt;The SQL Server Books online is an excellent resource for a more detailed description of lock modes, compatibility and related information so I won’t repeat that information here.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I strongly recommend that serious database professionals peruse the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms190615.aspx"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;Locking in the Database Engine&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; topic of the SQL Server Books Online, especially the following subtopics:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms175519.aspx"&gt;&lt;font size="3"&gt;&lt;font color="#800080"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;SQL Server 2005 Books Online: Lock Modes&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms186396.aspx"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;SQL Server 2005 Books Online: Lock Compatibility&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms189849.aspx"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;Lock Granularity and Hierarchies&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 style="MARGIN: 24pt 0in 0pt; LINE-HEIGHT: 115%; mso-pagination: widow-orphan lines-together"&gt;&lt;span style="FONT-SIZE: 14pt; COLOR: #365f91; LINE-HEIGHT: 115%; FONT-FAMILY: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: major-latin; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-theme-font: major-bidi; mso-themecolor: accent1; mso-themeshade: 191"&gt;Deadlocking&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; tab-stops: 648.65pt"&gt;&lt;font face="Calibri" size="3"&gt;A deadlock is basically a special blocking scenario where 2 sessions are waiting on each other (directly or indirectly).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Neither can proceed so both will wait indefinitely unless a timeout or intervention occurs. &lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;Unlike a normal blocking scenario, SQL Server will intervene when a deadlock situation is detected and cancel one of the transactions involved.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The locks of the cancelled transaction are then released so the other blocked session can proceed.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;SQL Server chooses the transaction that is the least expensive to rollback as the deadlock victim by default.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;If &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms186736.aspx"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;SET DEADLOCK_PRIORITY&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; has been issued, SQL Server chooses the one with the lowest priority as the victim.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; tab-stops: 648.65pt"&gt;&lt;font face="Calibri" size="3"&gt;A deadlock always starts as a normal block with one session waiting while the other continues.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;It is only when the running session is later blocked by the waiting session that the deadlock occurs.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The scenario is easily illustrated by executing queries from 2 different SQL Server Management Studio query windows.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;First, create a table with insert test data:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid red; mso-border-insidev: .5pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 386.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt" valign="top" width="515"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;USE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; tempdb;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;CREATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;TABLE&lt;/span&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;DeadlockExample&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;DeadlockExampleKey &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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;            &lt;/span&gt;&lt;span style="COLOR: blue"&gt;CONSTRAINT&lt;/span&gt; PKDeadlockExample &lt;span style="COLOR: blue"&gt;PRIMARY&lt;/span&gt; &lt;span style="COLOR: blue"&gt;KEY&lt;/span&gt; &lt;span style="COLOR: blue"&gt;CLUSTERED&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;INSERT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;INTO&lt;/span&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;DeadlockExample &lt;span style="COLOR: gray"&gt;(&lt;/span&gt;DeadlockExampleKey&lt;span style="COLOR: gray"&gt;)&lt;/span&gt; &lt;span style="COLOR: blue"&gt;VALUES&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;1&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;INSERT&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;INTO&lt;/span&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;DeadlockExample &lt;span style="COLOR: gray"&gt;(&lt;/span&gt;DeadlockExampleKey&lt;span style="COLOR: gray"&gt;)&lt;/span&gt; &lt;span style="COLOR: blue"&gt;VALUES&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;2&lt;span style="COLOR: gray"&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; tab-stops: 648.65pt"&gt;&lt;font face="Calibri" size="3"&gt;Run the following from window 1:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid red; mso-border-insidev: .5pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 386.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt" valign="top" width="515"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;USE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; tempdb;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;BEGIN&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;TRAN&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;UPDATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;DeadlockExample&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 1&lt;span style="COLOR: gray"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; tab-stops: 648.65pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; tab-stops: 648.65pt"&gt;&lt;font face="Calibri" size="3"&gt;Then run this script from window 2:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid red; mso-border-insidev: .5pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 386.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt" valign="top" width="515"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;USE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; tempdb;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;BEGIN&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;TRAN&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;UPDATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;DeadlockExample&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 2&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;--this UPDATE will be blocked by session 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;UPDATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;DeadlockExample&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 1&lt;span style="COLOR: gray"&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;You can view session and lock info during this blocking episode by executing sp_who2 and sp_lock from a new SSMS window or you can use the Activity Monitor from the SSMS Object Explorer GUI.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;A query against the sys.dm_tran_locks DMV and sys.partitions catalog view will also show the table involved in this blocking episode:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid red; mso-border-insidev: .5pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 386.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt" valign="top" width="515"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SELECT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;&lt;span style="COLOR: fuchsia"&gt;OBJECT_NAME&lt;/span&gt;&lt;span style="COLOR: gray"&gt;(&lt;/span&gt;p&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;&lt;span style="COLOR: fuchsia"&gt;object_id&lt;/span&gt;&lt;span style="COLOR: gray"&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;FROM&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: green"&gt;sys.dm_tran_locks&lt;/span&gt; &lt;span style="COLOR: blue"&gt;AS&lt;/span&gt; dtl&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;JOIN&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: green"&gt;sys.partitions&lt;/span&gt; &lt;span style="COLOR: blue"&gt;AS&lt;/span&gt; p &lt;span style="COLOR: blue"&gt;ON&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;dtl&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;resource_associated_entity_id &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; p&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;hobt_id;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Finally, run the UPDATE below from window 1:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid red; mso-border-insidev: .5pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 386.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt" valign="top" width="515"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;UPDATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;DeadlockExample&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 6&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; DeadlockExampleKey &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 2&lt;span style="COLOR: gray"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;This will cause a deadlock between the sessions because session 1 is waiting for key 2 (exclusively by session 2) and session 2 is waiting for key 1 (exclusively locked by session 1).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;SQL Server will choose one of the sessions as a victim and that session will get rolled back and receive error 1205:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid black .5pt; mso-yfti-tbllook: 1184" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 688.1pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt" valign="top" width="917"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;Msg 1205, Level 13, State 51, Line 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;Transaction (Process ID 51) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;See the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms177433.aspx"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;Deadlocking&lt;/font&gt;&lt;/a&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt; topic Books Online for more information on deadlocks as well as information on diagnostic tools.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.sqlteam.com/dang/aggbug/60659.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://weblogs.sqlteam.com/dang/comments/60659.aspx</wfw:comment>
        <slash:comments>3</slash:comments>
        <wfw:commentRss>http://weblogs.sqlteam.com/dang/comments/commentRss/60659.aspx</wfw:commentRss>
        <trackback:ping>http://weblogs.sqlteam.com/dang/services/trackbacks/60659.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Performance and Concurrency</title>
        <link rel="self" type="text/html" href="http://weblogs.sqlteam.com/dang/archive/2008/06/28/Performance-and-Concurrency.aspx" />
        <id>http://weblogs.sqlteam.com/dang/archive/2008/06/28/Performance-and-Concurrency.aspx</id>
        <published>2008-06-28T09:15:33-05:00:00</published>
        <updated>2008-06-29T22:55:34Z</updated>
        <content type="html">&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Performance and concurrency go hand-in-hand.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In fact, these are more closely tied that many DBAs and developers realize.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I’ll underscore the important relationship between performance and concurrency in this last article of my concurrency series and explain why performance tuning can fix blocking problems in addition to improving response times.&lt;/font&gt;&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font face="Calibri" color="#17365d" size="4"&gt;Why Performance Affects Concurrency&lt;/font&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;A bad query execution plan touches much more data than necessary and also consumes inordinate CPU and disk resources.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The result is that more locks are acquired than needed and these are held for longer durations when concurrent queries complete for conflicting locks, CPU and disk resources.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This can lead to a downward spiral of hardware bottlenecks, long-duration locks, blocking and deadlocks.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I’ve seen some companies even throw hardware at such a problem rather than address the underlying cause.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Although faster hardware is one way to reduce lock duration deadlock likelihood and improve overall performance, this is most certainly not the best approach.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Keep in mind that unnecessarily high resource utilization manifests itself as a performance problem only in severe cases.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;An occasional query that scans thousands of rows when only a few are needed might barely be noticeable in Performance Monitor.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;However, the amount of rows touched greatly increases the likelihood that the query will block (or be blocked by) other concurrent queries.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;It is often only after the problem escalates into a severe blocking incident that a DBA becomes aware that the latent problem exists.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Tuning addresses blocking and deadlocking problems for a number of reasons.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Most importantly, index tuning provides an efficient path to data so minimal data needs to be locked while minimal CPU and disk resources are used.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Query tuning ensures that queries are formulated to achieve the desired result efficiently and that expressions are &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Sargable"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;sargable&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Best Practices in server configuration and maintenance, such as data and log files on different drives and keeping stats up-to-date, help transactions and queries run as quickly as possible.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Well-tuned databases consume minimal hardware resources so more queries can be processed concurrently and short-term blocking is not even noticeable.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;I strongly advocate examining query execution plans (ctrl-L in SSMS) before promoting stored procedures and queries to production.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Check to ensure that scans are done only when appropriate for the task at hand and indexes are used efficiently (seeks).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Even if query response time is adequate, a suboptimal plan can lead to avoidable concurrency problems.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Proactively examining execution plans is a great way to maximize both performance and concurrency.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.sqlteam.com/dang/aggbug/60642.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://weblogs.sqlteam.com/dang/comments/60642.aspx</wfw:comment>
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://weblogs.sqlteam.com/dang/comments/commentRss/60642.aspx</wfw:commentRss>
        <trackback:ping>http://weblogs.sqlteam.com/dang/services/trackbacks/60642.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Concurrency Model Confusion II</title>
        <link rel="self" type="text/html" href="http://weblogs.sqlteam.com/dang/archive/2008/06/07/Concurrency-Model-Confusion-II.aspx" />
        <id>http://weblogs.sqlteam.com/dang/archive/2008/06/07/Concurrency-Model-Confusion-II.aspx</id>
        <published>2008-06-07T14:49:43-05:00:00</published>
        <updated>2008-06-07T14:49:43Z</updated>
        <content type="html">&lt;font face="Calibri" size="3"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;In the first post of this series, I reviewed concurrency concepts and highlighted differences in concurrency terminology from a database and application perspective.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I’ll now discuss how applications can leverage SQL Server features to meet concurrency objectives.&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font color="#17365d" size="4"&gt;SQL Server Concurrency Terminology&lt;/font&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;Optimistic concurrency control inside the SQL Server 2005 database engine technically means that row versioning is used instead of a pessimistic locking approach.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I believe this is a source of much confusion to both application developers and DBAs because row versioning isn’t required for applications&lt;em style="mso-bidi-font-style: normal"&gt; &lt;/em&gt;to use optimistic concurrency control.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Applications have used optimistic concurrency long before row versioning was introduced in SQL Server 2005.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In fact, the rowversion data type (a.k.a. timestamp) exists specifically to facilitate optimistic concurrency control. &lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;I don’t personally like calling SQL Server concurrency control methods either optimistic or pessimistic.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I prefer to instead view concurrency control objectives from the application perspective and choose the SQL Server concurrency control features (transaction isolation levels, transactions, locking hints) that are most appropriate for the task at hand without getting tripped up on terminology.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For example, SQL Server optimistic row versioning should not be used solely because the application uses optimistic concurrency.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;A better choice for a well-tuned, highly transactional application might very well be default pessimistic SQL Server concurrency control behavior.&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font color="#17365d" size="4"&gt;Row Versioning and Concurrency&lt;/font&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;Row versioning isolation levels can improve concurrency because committed data can be read from the version store instead of acquiring locks on data read.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;All update and delete statements store pre-update versions of changed data in the tempdb version store once either the READ_COMMITTED_SNAPSHOT or ALLOW_SNAPSHOT_ISOLATION database option is turned on.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;SQL Server then returns these pre-update row versions to applications reading data in the READ_COMMITTED (with READ_COMMITTED_SNAPSHOT database option on) or SNAPSHOT transaction isolation levels.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The main difference between row versioning in these isolation levels is that READ_COMMITTED is single-statement level and SNAPSHOT is transaction level (multi-statement).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;See &lt;a href="http://msdn.microsoft.com/en-us/library/ms177404.aspx"&gt;&lt;font color="#800080"&gt;Row Versioning-based Isolation Levels in the Database Engine&lt;/font&gt;&lt;/a&gt; in the Books Online for details.&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;A DBA can sometimes address blocking/deadlocking concurrency problems unilaterally by simply turning on the READ_COMMITTED_SNAPSHOT database option because statement-level row versioning is transparent to applications running in the default READ_COMMITTED isolation level.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;However, this shouldn’t be done indiscriminately because row versioning has an associated cost in terms of disk I/O, storage, CPU and DBA management.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;One can even make concurrency problems worse by enabling row versioning unless there are sufficient server resources to handle the additional work introduced by row versioning.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;See the &lt;a href="http://blogs.msdn.com/sqlserverstorageengine/archive/2008/03/30/overhead-of-row-versioning.aspx"&gt;&lt;font color="#800080"&gt;Overhead of Row Versioning&lt;/font&gt;&lt;/a&gt; post in the SQL Server Storage team blog for more info on I/O and storage overhead.&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;SNAPSHOT isolation level row versioning can also improve concurrency.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;However, SNAPSHOT isolation is a different paradigm than most SQL Server developers are accustomed to.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;With SNAPSHOT isolation, applications have a consistent view of the database from the time the transaction starts so developers need to consider the ramifications of retrieving stale data and perhaps delegating the task of checking for changed data in an optimistic model to the database engine. &lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I elaborate more on SNAPSHOT later.&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font color="#17365d" size="4"&gt;Optimistic Concurrency from an Application Perspective&lt;/font&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;SQL Server applications have traditionally implemented optimistic concurrency by detecting conflicts when data are saved.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This is done by either comparing either the original/current values of the target columns or a rowversion column.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The READ_COMMITTED example below can run with or without row versioning enabled.&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;
&lt;/p&gt;&lt;table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .75pt solid red; mso-border-insidev: .75pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 6.65in; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt; mso-border-bottom-alt: solid red .75pt" valign="top" width="638"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;--retrieve latest values when user clicks edit&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET TRANSACTION ISOLATION LEVEL READ_COMMITTED;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SELECT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactName&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactTitle&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;FROM&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;Suppliers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; SupplierID &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @SupplierID;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="mso-yfti-irow: 1; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 6.65in; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt; mso-border-top-alt: solid red .75pt" valign="top" width="638"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;--check for conflicts when user clicks save&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;UPDATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;Suppliers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactName &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @NewContactName&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactTitle &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @NewContactTitle&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;SupplierID &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @SupplierID &lt;span style="COLOR: gray"&gt;AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactName &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @OriginalContactName &lt;span style="COLOR: gray"&gt;AND&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactTitle &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @OriginalContactTitle;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;IF&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; &lt;span style="COLOR: fuchsia"&gt;@@ROWCOUNT&lt;/span&gt; &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; 0 &lt;span style="COLOR: green"&gt;--a zero rowcount indicates data was deleted or changed&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;&lt;span style="COLOR: blue"&gt;RAISERROR&lt;/span&gt; &lt;span style="COLOR: gray"&gt;(&lt;/span&gt;&lt;span style="COLOR: red"&gt;'Contact information was changed by another user'&lt;/span&gt;&lt;span style="COLOR: gray"&gt;,&lt;/span&gt; 16&lt;span style="COLOR: gray"&gt;,&lt;/span&gt; 1&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;END;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;The above optimistic concurrency technique requires no persistent database connection.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Locks are held only for the short duration of the initial SELECT (and only when READ_COMMITTED_SNAPSHOT is off) and again during the subsequent update.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;No persistent database connection is needed because no explicit transaction is used.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This same method can be used with or without the READ_COMMITTED_SNAPSHOT database option turned on.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;Applications can also leverage SQL Server’s SNAPSHOT transaction isolation level to implement optimistic concurrency.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In the following example, a transaction is started and persistent database connection is maintained until the COMMIT:&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;
&lt;/p&gt;&lt;table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid red; mso-border-insidev: .5pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 6.65in; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt" valign="top" width="638"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;--retrieve latest values when user clicks edit&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET TRANSACTION ISOLATION LEVEL SNAPSHOT;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET XACT_ABORT ON;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;BEGIN TRAN;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SELECT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactName&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactTitle&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;FROM&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;Suppliers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; SupplierID &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @SupplierID;&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="mso-yfti-irow: 1; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 6.65in; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt; mso-border-top-alt: solid red .5pt" valign="top" width="638"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;--no need to check for changed data when user clicks save&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;UPDATE&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt; dbo&lt;span style="COLOR: gray"&gt;.&lt;/span&gt;Suppliers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;SET&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactName &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @NewContactName&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: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;ContactTitle &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @NewContactTitle&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;WHERE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;SupplierID &lt;span style="COLOR: gray"&gt;=&lt;/span&gt; @SupplierID&lt;span style="COLOR: blue"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;COMMIT;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;Unlike the READ_COMMITED method, the UPDATE statement in the SNAPSHOT level doesn’t need to check for changed data.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;SQL Server will raise an exception during the UPDATE if data was changed by another session since the start of the transaction.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In this SNAPSHOT example, error 3960 is raised if the Supplier row changed since the transaction started:&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;
&lt;/p&gt;&lt;table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid red .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid red; mso-border-insidev: .5pt solid red" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: red 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: red 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: red 1pt solid; WIDTH: 6.65in; PADDING-TOP: 0in; BORDER-BOTTOM: red 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid red .5pt" valign="top" width="638"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;Msg 3960, Level 16, State 2, Line 13&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes"&gt;Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'dbo.Suppliers' directly or indirectly in database 'Northwind' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.&lt;/span&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt; &lt;/o:p&gt;The persistent database connection requirement limits SNAPSHOT isolation scalability so it shouldn’t be used as a general means of implementing optimistic concurrency.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;It wouldn’t be practical to maintain open transactions for thousands of concurrent web user sessions or keep transactions open indefinitely while waiting for user response.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;However, SNAPSHOT is a viable alternative to the SERIALIZABLE transaction isolation level.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Applications that would otherwise require SERIALIZABLE might consider SNAPSHOT alternative to improve concurrency.&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt; &lt;/p&gt;
&lt;/font&gt;&lt;img src="http://weblogs.sqlteam.com/dang/aggbug/60621.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://weblogs.sqlteam.com/dang/comments/60621.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://weblogs.sqlteam.com/dang/comments/commentRss/60621.aspx</wfw:commentRss>
        <trackback:ping>http://weblogs.sqlteam.com/dang/services/trackbacks/60621.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Concurrency Model Confusion</title>
        <link rel="self" type="text/html" href="http://weblogs.sqlteam.com/dang/archive/2008/05/04/Concurrency-Model-Confusion.aspx" />
        <id>http://weblogs.sqlteam.com/dang/archive/2008/05/04/Concurrency-Model-Confusion.aspx</id>
        <published>2008-05-04T19:12:36-05:00:00</published>
        <updated>2008-05-04T19:12:36Z</updated>
        <content type="html">&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Concurrency is confusing.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Terms line “optimistic concurrency control” and “pessimistic concurrency control” can mean quite different things depending on the context.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;I hope to clarify some points surrounding concurrency as it relates to application and database design with a series of posts.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In this first post, I’ll review some basic concurrency concepts and highlight some differences in concurrency models from a database and application perspective.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;In computer science, “concurrency control ensures that correct results for concurrent operations are generated, while getting those results as quickly as possible” (from the &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/Concurrency_control"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;Concurrency control wiki&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Every major DBMS supports &lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/ACID"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;ACID&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; transactional reliability so one might think “correct results” would be a non-issue.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In practice however, both the application and database must work in concert to provide the appropriate level of data integrity and performance while minimizing user rework to address conflicts and deadlocks.&lt;/font&gt;&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font face="Calibri" color="#17365d" size="4"&gt;Concurrency Control:&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Optimistic, Pessimistic and Chaos &lt;/font&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;“Optimistic”, “pessimistic” and “chaos” refer to the safeguards one takes based on the likelihood of concurrent updates and how much rework is acceptable.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Optimistic concurrency control is used when it is unlikely that different users will update the same data.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In the unlikely event that the same data is updated by different users, the conflict is detected when data are saved and the second user must redo/merge changes in order to prevent overwriting the changes made by the first user.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Users of a well designed optimistic concurrency application experience fast response time and are inconvenienced only in the rare case of an update conflict.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Pessimistic concurrency control is used when it is likely that the same data will be updated by different users.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;To prevent the need to redo or merge changes, an application serializes data access so that only one user can edit data at a time.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;The obvious downside is that subsequent users must wait until preceding user(s) has completed their changes and this can increase response time or data unavailability.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;However, overall user productivity can be better than optimistic currency control because rework is avoided.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Chaos concurrency control (also known as Anarchy) is used in situations when concurrent updates are not possible or “last in wins” is acceptable.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;No safeguards need to be taken with chaos concurrency because there is either no chance of conflicts or overwrites are ok.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Chaos concurrency is typically used in single-user applications or in multi-user applications where data are segregated in such a way that concurrent updates are either not possible (e.g. unique web session key) or so unlikely (e.g. CustomerID key) that the risk of lower concurrency level isn’t warranted.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;The choice between optimistic, pessimistic and chaos involves striking a balance between data availability, integrity, rework and development effort.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;It is important to pick the concurrency model appropriate for the task at hand.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Using the wrong model can result in unnecessary blocking, long response times and data problems.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For example, using a chaos model in a multi-user system (which is often done inadvertently simply because concurrency wasn’t considered during development) can lead to lost updates.&lt;/font&gt;&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;font face="Calibri" color="#17365d" size="4"&gt;Concurrency Control Semantics&lt;/font&gt;&lt;/h2&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;The meanings of optimistic vs. pessimistic concurrency control are different depending on whether the context is the application or database server.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Here’s an excerpt from the SQL Server Books Online:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid black .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid black; mso-border-insidev: .5pt solid black" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 6.65in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt" valign="top" width="638"&gt;
            &lt;p class="MsoListParagraphCxSpFirst" style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Optimistic concurrency control works to minimize reader/writer blocking. With optimistic concurrency control methods, read operations do not use read locks that block data modification operations.&lt;/font&gt;&lt;/p&gt;
            &lt;p class="MsoListParagraphCxSpLast" style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Pessimistic concurrency control works to ensure that read operations access current data and that data being read cannot be modified. With pessimistic concurrency control methods, read operations use read locks that block data modification. The locks placed by a read operation are released when the read operation is finished.&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;&lt;font face="Calibri"&gt;Source: SQL Server 2005 Books Online, Types of Concurrency Control&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;(http://msdn.microsoft.com/en-us/library/ms189132.aspx)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Now let’s take a look at Types of Concurrency Control in the Visual Studio 2008 .NET documentation:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid black .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid black; mso-border-insidev: .5pt solid black" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 6.65in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt" valign="top" width="638"&gt;
            &lt;p class="MsoListParagraphCxSpFirst" style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Optimistic concurrency control: A row is unavailable to other users only while the data is actually being updated. The update examines the row in the database and determines whether any changes have been made. Attempting to update a record that has already been changed results in a concurrency violation.&lt;/font&gt;&lt;/p&gt;
            &lt;p class="MsoListParagraphCxSpLast" style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;span style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="FONT: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Pessimistic concurrency control: A row is unavailable to users from the time the record is fetched until it is updated in the database.&lt;/font&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;&lt;font face="Calibri"&gt;Visual Studio 2008 .NET, Types of Concurrency Control (http://msdn.microsoft.com/en-us/library/cs6hb8k4.aspx)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Here the table summarizing the VS and SQL 2005 documentation:&lt;/font&gt;&lt;/p&gt;
&lt;table class="MsoNormalTable" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid black .5pt; mso-yfti-tbllook: 1184; mso-border-insideh: .5pt solid black; mso-border-insidev: .5pt solid black" cellspacing="0" cellpadding="0" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 116.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt" valign="top" width="155"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; WIDTH: 1.75in; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt" valign="top" width="168" colspan="2"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: center" align="center"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Optimistic&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; WIDTH: 130.5pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-left-alt: solid black .5pt" valign="top" width="174" colspan="2"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: center" align="center"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Pessimistic&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="mso-yfti-irow: 1"&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1pt solid; WIDTH: 116.6pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt" valign="top" width="155"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;font face="Calibri" size="3"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; WIDTH: 63pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt" valign="top" width="84"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;font face="Calibri" size="3"&gt;SQL Server&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; WIDTH: 63pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt" valign="top" width="84"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Application&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="BORDER-RIGHT: black 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #f0f0f0; WIDTH: 67.5pt; PADDING-TOP: 0in; BORDER-BOTTOM: black 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid black .5pt; mso-border-top-alt: solid black .5pt; mso-border-left-alt: solid black .5pt" valign="top" width="90"&gt;
            &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;strong 