<?xml version="1.0" encoding="utf-8"?><!-- generator="b2evolution/6.11.7-stable" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Holger Schmeling - Category: "SQL Server Tips"</title>
		<link>https://www.insidesql.org/blogs/holgerschmeling/</link>
		<atom:link rel="self" type="application/rss+xml" href="https://www.insidesql.org/blogs/holgerschmeling/?tempskin=_rss2" />
		<description>InsideSQL.org Blogs - Blogs über SQL Server</description>
		<language>en-EU</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=6.11.7-stable"/>
		<ttl>60</ttl>
				<item>
			<title>SQL Server Start Time</title>
			<link>https://www.insidesql.org/blogs/holgerschmeling/2011/02/22/sql-server-start-time</link>
			<pubDate>Tue, 22 Feb 2011 07:12:44 +0000</pubDate>			<dc:creator>Holger Schmeling</dc:creator>
			<category domain="alt">SQL Server Administration</category>
<category domain="alt">SQL Server Tips</category>
<category domain="main">Monitoring</category>			<guid isPermaLink="false">2673@https://www.insidesql.org/blogs/</guid>
						<description>&lt;p&gt;Have you tried finding out the time, your SQL Server instance has been started? There are some sophisticated solutions, like the one from Tracy Hamlin (&lt;a href=&quot;http://twitter.com/tracyhhamlin&quot;&gt;twitter&lt;/a&gt;), which takes advantage of the fact that tempdb is re-created every time, SQL Server starts. Her solution goes like this:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: Lucida Console; color: #0000ff;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; create_date                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;databases&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; database_id&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Another answer to the question, I&#039;ve seen sometimes on the internet queries the login time for any of the system processes:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: Lucida Console; color: #0000ff;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; login_time                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;dm_exec_sessions&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; session_id&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;This was my preferred way - until yesterday, when I discovered the following simple method:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: Lucida Console; color: #0000ff;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; sqlserver_start_time                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;font-size: 11pt; color: #008000;&quot;&gt;dm_os_sys_info&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Easy, isn&#039;t it? Interestingly though, every of the above three queries yields a different result. Here&#039;s a query with a sample output:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;select &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: #808080;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-ansi-language: en-us; mso-no-proof: yes&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; sqlserver_start_time                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;dm_os_sys_info&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; sql_server_start_time                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;,(&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; create_date                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;databases&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; database_id&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; tempdb_creation_time                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;,(&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;select&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Lucida Console;&quot;&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt; login_time                    &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;dm_exec_sessions&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; session_id&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; &lt;/span&gt;&lt;span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;as&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt; sysprocess_login_time&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Result:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/blogs/media/blogs/holgerschmeling/windows-live-writer/11d5cb6a4278_6b47/image_2.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;image&quot; src=&quot;/blogs/media/blogs/holgerschmeling/windows-live-writer/11d5cb6a4278_6b47/image_thumb.png&quot; border=&quot;0&quot; alt=&quot;image&quot; width=&quot;671&quot; height=&quot;49&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It seems the SQL Server service must be started first. Only after the service is running, tempdb is created followed by a subsequent start of all sysprocesses. I can&#039;t imagine that the diverse three times make any difference in practice, e.g. if you try finding out for how many hours your SQL Server instance is running. But out there may be existing applications that have to be aware of the difference.&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>Have you tried finding out the time, your SQL Server instance has been started? There are some sophisticated solutions, like the one from Tracy Hamlin (<a href="http://twitter.com/tracyhhamlin">twitter</a>), which takes advantage of the fact that tempdb is re-created every time, SQL Server starts. Her solution goes like this:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none"><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="font-family: Lucida Console; color: #0000ff;"><span style="font-size: 11pt;">select</span></span></span><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="font-family: Lucida Console;"><span style="font-size: 11pt;"><span style="color: #000000;"> create_date                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #0000ff;">from</span></span><span style="color: #000000;"> </span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">databases</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">where</span></span><span style="color: #000000;"> database_id</span><span><span style="color: #808080;">=</span></span><span style="color: #000000;">2</span></span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p>Another answer to the question, I've seen sometimes on the internet queries the login time for any of the system processes:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none"><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="font-family: Lucida Console; color: #0000ff;"><span style="font-size: 11pt;">select</span></span></span><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="font-family: Lucida Console;"><span style="font-size: 11pt;"><span style="color: #000000;"> login_time                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #0000ff;">from</span></span><span style="color: #000000;"> </span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">dm_exec_sessions</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">where</span></span><span style="color: #000000;"> session_id</span><span><span style="color: #808080;">=</span></span><span style="color: #000000;">1</span></span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p>This was my preferred way - until yesterday, when I discovered the following simple method:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none"><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="font-family: Lucida Console; color: #0000ff;"><span style="font-size: 11pt;">select</span></span></span><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="font-family: Lucida Console;"><span style="font-size: 11pt;"><span style="color: #000000;"> sqlserver_start_time                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #0000ff;">from</span></span><span style="color: #000000;"> </span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span></span><span><span style="font-size: 11pt; color: #008000;">dm_os_sys_info</span></span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p>Easy, isn't it? Interestingly though, every of the above three queries yields a different result. Here's a query with a sample output:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8db3e2; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8db3e2; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border-bottom: #8db3e2 1pt dashed; border-left: #8db3e2 1pt dashed; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; border-top: #8db3e2 1pt dashed; border-right: #8db3e2 1pt dashed; padding-top: 0in; mso-border-alt: dashed #8db3e2 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none"><span style="font-family: Lucida Console;"><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="color: #0000ff;"><span style="font-size: 11pt;">select </span></span></span><span style="font-size: 11pt;"><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="color: #808080;">(</span></span><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="color: #0000ff;">select</span></span></span></span><span style="font-family: ; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes" lang="EN-US"><span style="font-size: 11pt;"><span style="font-family: Lucida Console;"><span style="color: #000000;"> sqlserver_start_time                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #0000ff;">from</span></span><span style="color: #000000;"> </span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">dm_os_sys_info</span></span><span><span style="color: #808080;">)</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">as</span></span></span><span style="font-family: Lucida Console;"><span style="color: #000000;"> sql_server_start_time                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #808080;">,(</span></span><span><span style="color: #0000ff;">select</span></span></span><span style="font-family: Lucida Console;"><span style="color: #000000;"> create_date                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #0000ff;">from</span></span><span style="color: #000000;"> </span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">databases</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">where</span></span><span style="color: #000000;"> database_id</span><span><span style="color: #808080;">=</span></span><span style="color: #000000;">2</span><span><span style="color: #808080;">)</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">as</span></span></span><span style="font-family: Lucida Console;"><span style="color: #000000;"> tempdb_creation_time                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #808080;">,(</span></span><span><span style="color: #0000ff;">select</span></span></span></span><span style="font-family: Lucida Console;"><span style="font-size: 11pt;"><span style="color: #000000;"> login_time                    <br /><span style="mso-spacerun: yes"> </span></span><span><span style="color: #0000ff;">from</span></span><span style="color: #000000;"> </span><span><span style="color: #008000;">sys</span></span><span><span style="color: #808080;">.</span></span><span><span style="color: #008000;">dm_exec_sessions</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">where</span></span><span style="color: #000000;"> session_id</span><span><span style="color: #808080;">=</span></span><span style="color: #000000;">1</span><span><span style="color: #808080;">)</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">as</span></span><span style="color: #000000;"> sysprocess_login_time</span></span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p>Result:</p>
<p><a href="/blogs/media/blogs/holgerschmeling/windows-live-writer/11d5cb6a4278_6b47/image_2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" src="/blogs/media/blogs/holgerschmeling/windows-live-writer/11d5cb6a4278_6b47/image_thumb.png" border="0" alt="image" width="671" height="49" /></a></p>
<p>It seems the SQL Server service must be started first. Only after the service is running, tempdb is created followed by a subsequent start of all sysprocesses. I can't imagine that the diverse three times make any difference in practice, e.g. if you try finding out for how many hours your SQL Server instance is running. But out there may be existing applications that have to be aware of the difference.</p>]]></content:encoded>
								<comments>https://www.insidesql.org/blogs/holgerschmeling/2011/02/22/sql-server-start-time#comments</comments>
			<wfw:commentRss>https://www.insidesql.org/blogs/holgerschmeling/?tempskin=_rss2&#38;disp=comments&#38;p=2673</wfw:commentRss>
		</item>
				<item>
			<title>Did you know: Aggregate functions on floats may be non-deterministic</title>
			<link>https://www.insidesql.org/blogs/holgerschmeling/2010/11/02/did-you-know-aggregate-functions-on-floats-may-be-non-deterministic</link>
			<pubDate>Tue, 02 Nov 2010 17:57:49 +0000</pubDate>			<dc:creator>Holger Schmeling</dc:creator>
			<category domain="main">SQL Server Performance</category>
<category domain="alt">SQL Server Tips</category>			<guid isPermaLink="false">1718@https://www.insidesql.org/blogs/</guid>
						<description>&lt;p&gt;One day some of the report-users mentioned that, every time they run a report, they get different results. My first idea was that there were some undergoing data changes, probably from a different connection/user, so this would explain it. But it turned out that no modifications were made. Even setting the database to read only did not help. Numbers in reports differed by about 20% with every execution.&lt;/p&gt;
&lt;p&gt;Delving into it, I could isolate the problem. It was a single SELECT statement that, when invoked, returned different results. The numbers differed by up to 20% in value without any data changes being performed!&lt;/p&gt;
&lt;p&gt;Have a look at the following sample. We create a test table to demonstrate what I&#039;m talking about:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 6pt 0in&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: blue; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt;use&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt; tempdb              &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;go                &lt;br /&gt; &lt;br /&gt;if &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;object_id&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red&quot;&gt;&#039;SumTest&#039;&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red&quot;&gt;&#039;U&#039;&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;is&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;null)                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;drop&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;table&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;go&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;create&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;table&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;floatVal &lt;span style=&quot;color: blue&quot;&gt;float&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;null                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;decimalVal &lt;span style=&quot;color: blue&quot;&gt;decimal&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;20&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;4&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;null                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;filler &lt;span style=&quot;color: blue&quot;&gt;nchar&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;300&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: red&quot;&gt;&#039;#&#039;                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: gray; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes&quot;&gt;)              &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: blue; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes&quot;&gt;go&lt;/span&gt;&lt;span style=&quot;mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The table has three columns, where the third column only serves the purpose of filling up the row, so the table contains more data pages.&lt;/p&gt;
&lt;p&gt;Let&#039;s now insert 600000 rows into our table:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 6pt 0in; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: blue; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt;declare&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt; @x &lt;span style=&quot;color: blue&quot;&gt;float                &lt;br /&gt;set&lt;/span&gt; @x &lt;span style=&quot;color: gray&quot;&gt;=&lt;/span&gt; 1000000000000000.9999&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt; &lt;br /&gt; &lt;br /&gt;&lt;span style=&quot;color: green&quot;&gt;-- Insert 300000 identical rows                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;insert&lt;/span&gt; SumTest&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt; decimalVal&lt;span style=&quot;color: gray&quot;&gt;)                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;top&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;300000&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; @x&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt; @x               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: green&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green&quot;&gt;trace_event_bindings&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; b1               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green&quot;&gt;trace_event_bindings&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; b2               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: green&quot;&gt;-- Again insert 300000 rows.                &lt;br /&gt;-- This time with negative sign                 &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;insert&lt;/span&gt; SumTest&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt; decimalVal&lt;span style=&quot;color: gray&quot;&gt;)                &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;top&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;300000&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;-&lt;/span&gt;@x&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: gray&quot;&gt;-&lt;/span&gt;@x               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: green&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green&quot;&gt;trace_event_bindings&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; b1               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: green&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green&quot;&gt;trace_event_bindings&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; b2&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The first INSERT statement adds 300000 rows with positive values for the two columns floatVal and decimalVal. After that, we insert another 300000 rows, this time with inverse signs. So in total, values for each of the two columns should add up to zero. Let&#039;s check this by invoking the summation over all rows a few times:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 6pt 0in; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: blue; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest               &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;union&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: blue&quot;&gt;select&lt;/span&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: gray; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: fuchsia; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: gray; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes&quot;&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;And here&#039;s the result:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/_-C4uSahz1Gg/S31vxEDbZqI/AAAAAAAABcg/y5viS3JM5as/s1600-h/image%5B7%5D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; src=&quot;http://lh4.ggpht.com/_-C4uSahz1Gg/S31vxlxQ7BI/AAAAAAAABck/RMH3Br1F6lg/image_thumb%5B7%5D.png?imgmax=800&quot; border=&quot;0&quot; alt=&quot;image&quot; width=&quot;295&quot; height=&quot;172&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As for the DECIMAL column, the outcome is as expected. But look at the totals for the FLOAT column. It&#039;s perfectly understandable, the sum will reveal some rounding errors. What really puzzled me is the difference between the numbers. Why isn&#039;t the rounding error the same for all executions?&lt;/p&gt;
&lt;p&gt;I was pretty sure that I discovered a bug in SQL Server and posted a regarding item on MSFT&#039;s connect platform (see &lt;a href=&quot;https://connect.microsoft.com/SQLServer/feedback/details/465147/select-sum-is-non-deterministic-when-adding-the-column-values-of-datatype-float&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Unfortunately nobody cared about my problem, and so I took the opportunity of talking to some fellows of the SQL Server CAT team on the occasion of the 2009 PASS Summit. After a while, I received an explanation which I&#039;d like to repeat here.&lt;/p&gt;
&lt;p&gt;The query is executed in parallel, as the plan reveals:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/_-C4uSahz1Gg/S31vyk37WKI/AAAAAAAABco/F0U8x6VjF-w/s1600-h/image1%5B1%5D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; src=&quot;http://lh4.ggpht.com/_-C4uSahz1Gg/S31vz8UvHoI/AAAAAAAABcs/IBL6nCIgdGU/image1_thumb.png?imgmax=800&quot; border=&quot;0&quot; alt=&quot;image&quot; width=&quot;982&quot; height=&quot;87&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When summing up values, usually the summation sequence doesn&#039;t matter. (If you remember some mathematics from school that&#039;s what the commutative law of addition is about). Therefore, reading values in multiple threads and adding up the values in any arbitrary order is perfect, as the order doesn&#039;t have any influence on the result. Well, at least theoretically. When adding float values, there&#039;s floating point arithmetic rounding errors with every addition. These added-up rounding errors are the reason for the non-zero values of the float totals in our example. So that&#039;s ok, but why different results with almost every execution? The reason for this is parallel execution. Added-up rounding errors &lt;em&gt;depend&lt;/em&gt; on the sequence, so the commutative law does not really apply to these errors. There&#039;s a chance that the sequence of rows changes with every execution, if the query is executed in parallel. And that&#039;s why the results change, dependent only on some butterfly wing movements at the other side of the world.&lt;/p&gt;
&lt;p&gt;If we add the MAXDOP 1 query hint, only one thread is utilized and the results are the same for every execution, although rounding errors still remain present. So this query:&lt;/p&gt;
&lt;table class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes&quot;&gt;
&lt;td style=&quot;border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;&quot; width=&quot;905&quot; valign=&quot;top&quot;&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 6pt 0in; mso-layout-grid-align: none&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; color: blue; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Lucida Console&amp;quot;; font-size: 12pt; mso-bidi-font-family: &#039;Times New Roman&#039;; mso-no-proof: yes; mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt; &lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;floatVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumFloatVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: fuchsia&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;decimalVal&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;as&lt;/span&gt; SumDecimalVal               &lt;br /&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;from&lt;/span&gt; SumTest &lt;span style=&quot;color: blue&quot;&gt;option &lt;/span&gt;&lt;span style=&quot;color: gray&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;maxdop&lt;/span&gt; 1&lt;span style=&quot;color: gray&quot;&gt;)&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;will be executed by using the following (single thread) execution plan:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://lh6.ggpht.com/_-C4uSahz1Gg/S31v040xHTI/AAAAAAAABcw/S3sP1BqTx8c/s1600-h/image7%5B1%5D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; src=&quot;http://lh3.ggpht.com/_-C4uSahz1Gg/S31v3V9wRDI/AAAAAAAABc4/nu24EdZdhyE/image7_thumb.png?imgmax=800&quot; border=&quot;0&quot; alt=&quot;image&quot; width=&quot;511&quot; height=&quot;85&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This time the result (and also the rounding error) is always the same.&lt;/p&gt;
&lt;p&gt;Pretty soon after delivering the explanation, the bug was closed. Reason: the observed behavior is &quot;by design&quot;.&lt;/p&gt;
&lt;p&gt;I can understand that the problem originates from computer resp. processor architecture and MSFT has no chance of control therefore.&lt;/p&gt;
&lt;p&gt;Although.&lt;/p&gt;
&lt;p&gt;When using SSAS&#039; write back functionality, SSAS will always create numeric columns of FLOAT data types. There&#039;s no chance of manipulating the data type; it&#039;s &lt;em&gt;always&lt;/em&gt; float!&lt;/p&gt;
&lt;p&gt;Additionally, SSAS more often than not inserts rows into write back tables with vastly large resp. small values. When looking an these rows, it appeared that they are created solely with the intention of summing up to zero. We discovered plenty of these rows containing inverse values that usually should nullify in total, but apparently don&#039;t. By the way that&#039;s why closing the bug with the &quot;By Design&quot; explanation makes me somewhat sad.&lt;/p&gt;
&lt;p&gt;So, probably avoiding FLOATs is a good idea! Unfortunately, this is simply not possible in all cases and sometimes out of our control.&lt;/p&gt;</description>
			<content:encoded><![CDATA[<p>One day some of the report-users mentioned that, every time they run a report, they get different results. My first idea was that there were some undergoing data changes, probably from a different connection/user, so this would explain it. But it turned out that no modifications were made. Even setting the database to read only did not help. Numbers in reports differed by about 20% with every execution.</p>
<p>Delving into it, I could isolate the problem. It was a single SELECT statement that, when invoked, returned different results. The numbers differed by up to 20% in value without any data changes being performed!</p>
<p>Have a look at the following sample. We create a test table to demonstrate what I'm talking about:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 6pt 0in"><span style="font-family: &quot;Lucida Console&quot;; color: blue; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US">use</span><span style="font-family: &quot;Lucida Console&quot;; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"> tempdb              <br /><span style="color: blue">go                <br /> <br />if </span><span style="color: gray">(</span><span style="color: fuchsia">object_id</span><span style="color: gray">(</span><span style="color: red">'SumTest'</span><span style="color: gray">,</span> <span style="color: red">'U'</span><span style="color: gray">)</span> <span style="color: gray">is</span> <span style="color: gray">not</span> <span style="color: gray">null)                <br /></span><span style="mso-spacerun: yes"> </span><span style="color: blue">drop</span> <span style="color: blue">table</span> SumTest               <br /><span style="color: blue">go</span><span style="mso-spacerun: yes"> </span> <br /><span style="color: blue">create</span> <span style="color: blue">table</span> SumTest               <br /><span style="color: blue"><span style="mso-spacerun: yes"> </span></span><span style="color: gray">(                <br /></span><span style="mso-spacerun: yes"> </span>floatVal <span style="color: blue">float</span> <span style="color: gray">not</span> <span style="color: gray">null                <br /></span><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span>decimalVal <span style="color: blue">decimal</span><span style="color: gray">(</span>20<span style="color: gray">,</span>4<span style="color: gray">)</span> <span style="color: gray">not</span> <span style="color: gray">null                <br /></span><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span>filler <span style="color: blue">nchar</span><span style="color: gray">(</span>300<span style="color: gray">)</span> <span style="color: gray">not</span> <span style="color: gray">null</span> <span style="color: blue">default</span> <span style="color: red">'#'                <br /></span><span style="mso-spacerun: yes"> </span></span><span style="font-family: &quot;Lucida Console&quot;; color: gray; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">)              <br /></span><span style="font-family: &quot;Lucida Console&quot;; color: blue; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">go</span><span style="mso-ansi-language: en-us" lang="EN-US"> </span></p>
</td>
</tr>
</tbody>
</table>
<p>The table has three columns, where the third column only serves the purpose of filling up the row, so the table contains more data pages.</p>
<p>Let's now insert 600000 rows into our table:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 6pt 0in; mso-layout-grid-align: none"><span style="font-family: &quot;Lucida Console&quot;; color: blue; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US">declare</span><span style="font-family: &quot;Lucida Console&quot;; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"> @x <span style="color: blue">float                <br />set</span> @x <span style="color: gray">=</span> 1000000000000000.9999<span style="mso-spacerun: yes"> </span> <br /> <br /><span style="color: green">-- Insert 300000 identical rows                <br /></span><span style="color: blue">insert</span> SumTest<span style="color: gray">(</span>floatVal<span style="color: gray">,</span> decimalVal<span style="color: gray">)                <br /></span><span style="mso-spacerun: yes"> </span><span style="color: blue">select</span> <span style="color: blue">top</span><span style="color: gray">(</span>300000<span style="color: gray">)</span> @x<span style="color: gray">,</span> @x               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> <span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">trace_event_bindings</span> <span style="color: blue">as</span> b1               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">trace_event_bindings</span> <span style="color: blue">as</span> b2               <br /><span style="mso-spacerun: yes"> </span> <br /><span style="color: green">-- Again insert 300000 rows.                <br />-- This time with negative sign                 <br /></span><span style="color: blue">insert</span> SumTest<span style="color: gray">(</span>floatVal<span style="color: gray">,</span> decimalVal<span style="color: gray">)                <br /></span><span style="mso-spacerun: yes"> </span><span style="color: blue">select</span> <span style="color: blue">top</span><span style="color: gray">(</span>300000<span style="color: gray">)</span> <span style="color: gray">-</span>@x<span style="color: gray">,</span> <span style="color: gray">-</span>@x               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> <span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">trace_event_bindings</span> <span style="color: blue">as</span> b1               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">trace_event_bindings</span> <span style="color: blue">as</span> b2</span></p>
</td>
</tr>
</tbody>
</table>
<p>The first INSERT statement adds 300000 rows with positive values for the two columns floatVal and decimalVal. After that, we insert another 300000 rows, this time with inverse signs. So in total, values for each of the two columns should add up to zero. Let's check this by invoking the summation over all rows a few times:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 6pt 0in; mso-layout-grid-align: none"><span style="font-family: &quot;Lucida Console&quot;; color: blue; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US">select</span><span style="font-family: &quot;Lucida Console&quot;; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest               <br /><span style="color: blue">union</span> <br /><span style="color: blue">select</span> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span></span><span style="font-family: &quot;Lucida Console&quot;; color: gray; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">,</span><span style="font-family: &quot;Lucida Console&quot;; color: fuchsia; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">sum</span><span style="font-family: &quot;Lucida Console&quot;; color: gray; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">(</span><span style="font-family: &quot;Lucida Console&quot;; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest</span><span style="font-family: &quot;Lucida Console&quot;; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"> </span></p>
</td>
</tr>
</tbody>
</table>
<p>And here's the result:</p>
<p><a href="http://lh5.ggpht.com/_-C4uSahz1Gg/S31vxEDbZqI/AAAAAAAABcg/y5viS3JM5as/s1600-h/image%5B7%5D.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://lh4.ggpht.com/_-C4uSahz1Gg/S31vxlxQ7BI/AAAAAAAABck/RMH3Br1F6lg/image_thumb%5B7%5D.png?imgmax=800" border="0" alt="image" width="295" height="172" /></a></p>
<p>As for the DECIMAL column, the outcome is as expected. But look at the totals for the FLOAT column. It's perfectly understandable, the sum will reveal some rounding errors. What really puzzled me is the difference between the numbers. Why isn't the rounding error the same for all executions?</p>
<p>I was pretty sure that I discovered a bug in SQL Server and posted a regarding item on MSFT's connect platform (see <a href="https://connect.microsoft.com/SQLServer/feedback/details/465147/select-sum-is-non-deterministic-when-adding-the-column-values-of-datatype-float" target="_blank">here</a>).</p>
<p>Unfortunately nobody cared about my problem, and so I took the opportunity of talking to some fellows of the SQL Server CAT team on the occasion of the 2009 PASS Summit. After a while, I received an explanation which I'd like to repeat here.</p>
<p>The query is executed in parallel, as the plan reveals:</p>
<p><a href="http://lh3.ggpht.com/_-C4uSahz1Gg/S31vyk37WKI/AAAAAAAABco/F0U8x6VjF-w/s1600-h/image1%5B1%5D.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://lh4.ggpht.com/_-C4uSahz1Gg/S31vz8UvHoI/AAAAAAAABcs/IBL6nCIgdGU/image1_thumb.png?imgmax=800" border="0" alt="image" width="982" height="87" /></a></p>
<p>When summing up values, usually the summation sequence doesn't matter. (If you remember some mathematics from school that's what the commutative law of addition is about). Therefore, reading values in multiple threads and adding up the values in any arbitrary order is perfect, as the order doesn't have any influence on the result. Well, at least theoretically. When adding float values, there's floating point arithmetic rounding errors with every addition. These added-up rounding errors are the reason for the non-zero values of the float totals in our example. So that's ok, but why different results with almost every execution? The reason for this is parallel execution. Added-up rounding errors <em>depend</em> on the sequence, so the commutative law does not really apply to these errors. There's a chance that the sequence of rows changes with every execution, if the query is executed in parallel. And that's why the results change, dependent only on some butterfly wing movements at the other side of the world.</p>
<p>If we add the MAXDOP 1 query hint, only one thread is utilized and the results are the same for every execution, although rounding errors still remain present. So this query:</p>
<table class="MsoTableGrid" style="border-bottom: medium none; border-left: medium none; border-collapse: collapse; background: #f5f0df; border-top: medium none; border-right: medium none; mso-border-alt: dashed #8eb4e3 .5pt; mso-border-themecolor: text2; mso-border-themetint: 102; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt dashed #8eb4e3; mso-border-insideh-themecolor: text2; mso-border-insideh-themetint: 102; mso-border-insidev: .5pt dashed #8eb4e3; mso-border-insidev-themecolor: text2; mso-border-insidev-themetint: 102" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<td style="border: 1pt dashed #8eb4e3; padding: 0in 5.4pt; width: 678.75pt;" width="905" valign="top">
<p class="MsoNormal" style="line-height: normal; margin: 6pt 0in; mso-layout-grid-align: none"><span style="font-family: &quot;Lucida Console&quot;; color: blue; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US">select</span><span style="font-family: &quot;Lucida Console&quot;; font-size: 12pt; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us" lang="EN-US"> <span style="color: fuchsia">sum</span><span style="color: gray">(</span>floatVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumFloatVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: gray">,</span><span style="color: fuchsia">sum</span><span style="color: gray">(</span>decimalVal<span style="color: gray">)</span> <span style="color: blue">as</span> SumDecimalVal               <br /><span style="mso-spacerun: yes"> </span><span style="color: blue">from</span> SumTest <span style="color: blue">option </span><span style="color: gray">(</span><span style="color: blue">maxdop</span> 1<span style="color: gray">)</span> </span></p>
</td>
</tr>
</tbody>
</table>
<p>will be executed by using the following (single thread) execution plan:</p>
<p><a href="http://lh6.ggpht.com/_-C4uSahz1Gg/S31v040xHTI/AAAAAAAABcw/S3sP1BqTx8c/s1600-h/image7%5B1%5D.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://lh3.ggpht.com/_-C4uSahz1Gg/S31v3V9wRDI/AAAAAAAABc4/nu24EdZdhyE/image7_thumb.png?imgmax=800" border="0" alt="image" width="511" height="85" /></a></p>
<p>This time the result (and also the rounding error) is always the same.</p>
<p>Pretty soon after delivering the explanation, the bug was closed. Reason: the observed behavior is "by design".</p>
<p>I can understand that the problem originates from computer resp. processor architecture and MSFT has no chance of control therefore.</p>
<p>Although.</p>
<p>When using SSAS' write back functionality, SSAS will always create numeric columns of FLOAT data types. There's no chance of manipulating the data type; it's <em>always</em> float!</p>
<p>Additionally, SSAS more often than not inserts rows into write back tables with vastly large resp. small values. When looking an these rows, it appeared that they are created solely with the intention of summing up to zero. We discovered plenty of these rows containing inverse values that usually should nullify in total, but apparently don't. By the way that's why closing the bug with the "By Design" explanation makes me somewhat sad.</p>
<p>So, probably avoiding FLOATs is a good idea! Unfortunately, this is simply not possible in all cases and sometimes out of our control.</p>]]></content:encoded>
								<comments>https://www.insidesql.org/blogs/holgerschmeling/2010/11/02/did-you-know-aggregate-functions-on-floats-may-be-non-deterministic#comments</comments>
			<wfw:commentRss>https://www.insidesql.org/blogs/holgerschmeling/?tempskin=_rss2&#38;disp=comments&#38;p=1718</wfw:commentRss>
		</item>
			</channel>
</rss>
