<rss version="2.0" 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:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>SQL Server</title>
        <link>http://geekswithblogs.net/chrishan/category/6285.aspx</link>
        <description>SQL Server</description>
        <language>en-US</language>
        <copyright>Chris Han</copyright>
        <managingEditor>chrishan2000@hotmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>A little after lunch game for T-SQL develoepr - how confident are you with your code?</title>
            <link>http://geekswithblogs.net/chrishan/archive/2007/10/23/116264.aspx</link>
            <description>&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;Here is how you should play it:&lt;br /&gt;
1. Make sure your have both a SQL 2000 with latest sp and a SQL 2005 database&lt;br /&gt;
2. guess the result of the two 'print' command in the script below, write down the last character in the string on your mind&lt;br /&gt;
3. Run the script below in SQL 2000&lt;br /&gt;
4. Change the 3999 to 3998 and run it again on SQL 2000&lt;br /&gt;
5. Change the 3998 back to 3999 and run it on SQL 2005&lt;/p&gt;
&lt;p&gt; ---------------------------------------&lt;/p&gt;
&lt;p&gt;declare @n varchar(4000) &lt;/p&gt;
&lt;p&gt;set @n = replicate(N'z',3999)+N'i' &lt;/p&gt;
&lt;p&gt;print @n &lt;/p&gt;
&lt;p&gt;set @n=replace(@n, N'i', N'B') &lt;/p&gt;
&lt;p&gt;print @n &lt;/p&gt;
&lt;p&gt;-----------------------------------------&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;have fun&lt;/p&gt;
&lt;/font&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116264"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116264" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/chrishan/aggbug/116264.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Chris Han</dc:creator>
            <guid>http://geekswithblogs.net/chrishan/archive/2007/10/23/116264.aspx</guid>
            <pubDate>Tue, 23 Oct 2007 16:55:51 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/chrishan/comments/116264.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/chrishan/archive/2007/10/23/116264.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/chrishan/comments/commentRss/116264.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/chrishan/services/trackbacks/116264.aspx</trackback:ping>
        </item>
        <item>
            <title>Error: System.Data.SqlClient.SqlException: Timeout expired</title>
            <link>http://geekswithblogs.net/chrishan/archive/2007/06/28/113536.aspx</link>
            <description>&lt;p&gt;I got this error when testing my web service POC which is runing on .netFx 2.0:&lt;br /&gt;
&lt;font face="Arial"&gt;&lt;br /&gt;
System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;I find Angel's article gives the most accurate diagnosis. Check it out here:&lt;br /&gt;
&lt;font face="Arial"&gt;&lt;a href="http://blogs.msdn.com/angelsb/archive/2004/08/25/220333.aspx"&gt;http://blogs.msdn.com/angelsb/archive/2004/08/25/220333.aspx&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;But the solution he gives out doesn't solve the problem:&lt;br /&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;public void DoesNotLeakConnections()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;{&lt;span style="mso-tab-count: 1"&gt;           &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 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 2"&gt;                  &lt;/span&gt;Using (SqlConnection sqlconnection1 = new SqlConnection("Server=.\\SQLEXPRESS ;Integrated security=sspi;connection timeout=5")) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;sqlconnection1.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;SqlCommand sqlcommand1 = sqlconnection1.CreateCommand();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;sqlcommand1.CommandText = "raiserror ('This is a fake exception', 17,1)";&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;sqlcommand1.ExecuteNonQuery();&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;//this throws a SqlException every time it is called.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;sqlconnection1.Close(); //Still never gets called.&lt;/strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-spacerun: yes"&gt;                  &lt;/span&gt;} // Here sqlconnection1.Dispose is _&lt;em&gt;guaranteed&lt;/em&gt;_&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;/span&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;What you should do which is the best practice for any resource related job is to close the resource in a Final block like this:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/span&gt; &lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;public void DoesNotLeakConnections()&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 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;{&lt;span style="mso-tab-count: 1"&gt;           &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 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 2"&gt;                  &lt;/span&gt;Using (SqlConnection sqlconnection1 = new SqlConnection("Server=.\\SQLEXPRESS ;Integrated security=sspi;connection timeout=5")) {&lt;/span&gt;&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;try&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;/blockquote&gt;
&lt;p class="MsoNormal" dir="ltr" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;sqlconnection1.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" dir="ltr" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;SqlCommand sqlcommand1 = sqlconnection1.CreateCommand();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" dir="ltr" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;sqlcommand1.CommandText = "raiserror ('This is a fake exception', 17,1)";&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" dir="ltr" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;                              &lt;/span&gt;sqlcommand1.ExecuteNonQuery();&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;//this throws a SqlException every time it is called.&lt;/span&gt;&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;catch  &lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Exception&lt;/font&gt;&lt;font size="2"&gt; ex)&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;{&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;  //do something&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;}&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" size="2"&gt;finally&lt;/font&gt; &lt;/font&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
&lt;/p&gt;&lt;p&gt; &lt;/p&gt;

&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt; &lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 3"&gt;          &lt;/span&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;sqlconnection1.Close(); //Always gets called.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;/blockquote&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;strong style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-spacerun: yes"&gt;                  &lt;/span&gt;} // Here sqlconnection1.Dispose is _&lt;em&gt;guaranteed&lt;/em&gt;_&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;span style="mso-tab-count: 1"&gt;      &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113536"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113536" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/chrishan/aggbug/113536.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Chris Han</dc:creator>
            <guid>http://geekswithblogs.net/chrishan/archive/2007/06/28/113536.aspx</guid>
            <pubDate>Thu, 28 Jun 2007 14:49:17 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/chrishan/comments/113536.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/chrishan/archive/2007/06/28/113536.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/chrishan/comments/commentRss/113536.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/chrishan/services/trackbacks/113536.aspx</trackback:ping>
        </item>
        <item>
            <title>Is UPS tracking system creating another Y2K problem?</title>
            <link>http://geekswithblogs.net/chrishan/archive/2007/06/25/113453.aspx</link>
            <description>&lt;p&gt;My friend told me this morning, he's little confused with his UPS shipment tracking result.&lt;/p&gt;
&lt;p&gt;We all know that UPS' using 18 bits tracking number to 'uniquely' identify a shipment. But after I just saw my friend's tracking result page, I'm not sure about the 'unique' part any more.&lt;/p&gt;
&lt;p&gt;On the 'Package Progress' pane, UPS lists all the history of the shipment associated with the number:&lt;/p&gt;
&lt;table cellspacing="0" cellpadding="0" width="100%" border="1"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td class="sec-head" colspan="4"&gt;Package Progress &lt;/td&gt;
        &lt;/tr&gt;
        &lt;!-- Begin: Detail Title Row --&gt;
        &lt;tr class="sec-row-title"&gt;
            &lt;td class="sec-pad" width="100"&gt;Location &lt;/td&gt;
            &lt;td class="sec-pad" width="76"&gt;Date &lt;/td&gt;
            &lt;td class="sec-pad" align="right" width="81"&gt;Local Time &lt;/td&gt;
            &lt;td class="sec-pad" width="45%"&gt;Description &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="sec-row-od"&gt;
            &lt;td class="sec-pad"&gt;&lt;font style="BACKGROUND-COLOR: #ffff00"&gt;BROOKLYN,&lt;br /&gt;
            NY,  US&lt;/font&gt; &lt;/td&gt;
            &lt;td class="sec-pad"&gt;&lt;font style="BACKGROUND-COLOR: #ffff00"&gt;06/25/2007&lt;/font&gt; &lt;/td&gt;
            &lt;td class="sec-pad" align="right"&gt;9:47 A.M. &lt;/td&gt;
            &lt;td class="sec-pad"&gt;DELIVERY &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="sec-row-od"&gt;
            &lt;td class="sec-pad"&gt; &lt;/td&gt;
            &lt;td class="sec-pad"&gt;06/25/2007 &lt;/td&gt;
            &lt;td class="sec-pad" align="right"&gt;7:19 A.M. &lt;/td&gt;
            &lt;td class="sec-pad"&gt;OUT FOR DELIVERY &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="sec-row-ev"&gt;
            &lt;td class="sec-pad"&gt;BROOKLYN,&lt;br /&gt;
            NY,  US &lt;/td&gt;
            &lt;td class="sec-pad"&gt;06/22/2007 &lt;/td&gt;
            &lt;td class="sec-pad" align="right"&gt;11:38 P.M. &lt;/td&gt;
            &lt;td class="sec-pad"&gt;ARRIVAL SCAN &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="sec-row-od"&gt;
            &lt;td class="sec-pad"&gt;FARMINGDALE,&lt;br /&gt;
            NY,  US &lt;/td&gt;
            &lt;td class="sec-pad"&gt;06/22/2007 &lt;/td&gt;
            &lt;td class="sec-pad" align="right"&gt;10:29 P.M. &lt;/td&gt;
            &lt;td class="sec-pad"&gt;DEPARTURE SCAN &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="sec-row-od"&gt;
            &lt;td class="sec-pad"&gt; &lt;/td&gt;
            &lt;td class="sec-pad"&gt;06/22/2007 &lt;/td&gt;
            &lt;td class="sec-pad" align="right"&gt;8:11 P.M. &lt;/td&gt;
            &lt;td class="sec-pad"&gt;ORIGIN SCAN &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="sec-row-ev"&gt;
            &lt;td class="sec-pad"&gt;&lt;font style="BACKGROUND-COLOR: #ffff00"&gt;CHARLOTTE,&lt;br /&gt;
            NC,  US&lt;/font&gt; &lt;/td&gt;
            &lt;td class="sec-pad"&gt;&lt;font style="BACKGROUND-COLOR: #ffff00"&gt;11/06/2006&lt;/font&gt; &lt;/td&gt;
            &lt;td class="sec-pad" align="right"&gt;4:53 P.M. &lt;/td&gt;
            &lt;td class="sec-pad"&gt;DELIVERY &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;See the two high-lighted lines? Apparently, the tracking number is reused by UPS! I don't what's the policy for reusing a tracking number at UPS. But the common sense would be unless you have used all other possible numbers, right? That means all 18 bits of numbers have been used in roughly half year (11/06/2006~06/25/2007)! That's 10^17*26= 2,600,000,000,000,000,000 shipments! Man, 2.6 trillion, what a business! &lt;/p&gt;
&lt;p&gt;I guess it's a good news for sales department at UPS but headache for DBAs. Most our SQL server database are still using 'int' type as the unique id, which only supports 2^31-1 (2,147,483,647), even 'bigint' type which supporting up to 2^63-1 (9,223,372,036,854,775,807) - about 3.5 times of what UPS has used out in 6 months. It's about 1.7 yeas of OLTP data. After that, you have to move the data to a data warehouse! DBAs or database designer probably never think of such a big number in such a short time. Similar problem as Y2K, but this comes much quicker than any of us can ever imagine. Even Mr. Moore needs to adjust his law. &lt;/p&gt;
&lt;p&gt;What a great time for all geeks like you who’s reading my blog. But be prepared! Love yo’ll.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113453"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113453" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/chrishan/aggbug/113453.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Chris Han</dc:creator>
            <guid>http://geekswithblogs.net/chrishan/archive/2007/06/25/113453.aspx</guid>
            <pubDate>Mon, 25 Jun 2007 16:51:23 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/chrishan/comments/113453.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/chrishan/archive/2007/06/25/113453.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/chrishan/comments/commentRss/113453.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/chrishan/services/trackbacks/113453.aspx</trackback:ping>
        </item>
        <item>
            <title>New 'Row-Overflow' feature and the impact to database design in SQL 2005</title>
            <link>http://geekswithblogs.net/chrishan/archive/2007/02/27/107413.aspx</link>
            <description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;SQL 2K5 introduces a new behavior &lt;EM&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;row-overflow,&lt;/SPAN&gt;&lt;/EM&gt; which enable the combined row size exceed 8,060 bytes per row limit for varchar, nvarchar, varbinary, sql_variant or CLR user-defined type columns. For more details, check out BOL: &lt;A href="http://msdn2.microsoft.com/en-us/library/ms186981.aspx"&gt;&lt;FONT color=#000080&gt;http://msdn2.microsoft.com/en-us/library/ms186981.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;What's this mean to the database professionals? &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Good news&amp;nbsp;for data modelers is you don't have to worry about the error message 'Cannot create a row of size xxxx which is greater than the allowable maximum of 8060' when you try to update/insert a record whose total length of all columns exceeds 8060.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Bad news for DBAs, you may encounter a performance degrading because SQL&amp;nbsp;2K5 still maintains a limit of 8 KB per page, and for the rows&amp;nbsp;exceed 8060, the 'Row-Overflow' will kick in and move large records to another page dynamically, and perhaps, multiple I/Os operations will be needed in order to retrieve a single row of data. &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The suggestion is to normalize the table which will likely cause &lt;EM&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;row-overflow &lt;/SPAN&gt;&lt;/EM&gt;so that some columns are moved to another table.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Two&amp;nbsp;things need to clarify are: &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;A single of &lt;B&gt;varchar&lt;/B&gt;, &lt;B&gt;nvarchar&lt;/B&gt;, &lt;B&gt;varbinary&lt;/B&gt;, &lt;B&gt;sql_variant&lt;/B&gt;, and CLR user-defined type columns will still has the limit of 8000 bytes, although the entire row can exceed this restriction.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Large-value data types such as &lt;B&gt;varchar(max)&lt;/B&gt;, &lt;B&gt;nvarchar(max)&lt;/B&gt;, and &lt;B&gt;varbinary(max)&lt;/B&gt; &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;can store up to 2^31-1 bytes of data, &lt;B style="mso-bidi-font-weight: normal"&gt;XML&lt;/B&gt; type store 2GB data. The sp_tableoption system stored procedure with the “large value types out for row” option set to OFF can force the large data to be always stored out of row. You should only do this when you are very much sure the data in that column will exceed 8000 bytes – that is the size of a data page. Check out this article for Large-Value Data Types &lt;A href="http://www.databasejournal.com/features/mssql/article.php/3632906"&gt;&lt;FONT color=#000080&gt;http://www.databasejournal.com/features/mssql/article.php/3632906&lt;/FONT&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=107413"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=107413" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/chrishan/aggbug/107413.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Chris Han</dc:creator>
            <guid>http://geekswithblogs.net/chrishan/archive/2007/02/27/107413.aspx</guid>
            <pubDate>Tue, 27 Feb 2007 16:18:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/chrishan/comments/107413.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/chrishan/archive/2007/02/27/107413.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/chrishan/comments/commentRss/107413.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/chrishan/services/trackbacks/107413.aspx</trackback:ping>
        </item>
    </channel>
</rss>