<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DATEDIFF_BIG &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/datediff_big/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sun, 09 Apr 2017 19:58:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server 2016: New DATEDIFF_BIG to take difference for MICROSECOND, NANOSECOND, MILLISECOND</title>
		<link>https://www.dbrnd.com/2017/04/sql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 15 Apr 2017 16:16:05 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[DATEDIFF_BIG]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[MICROSECOND]]></category>
		<category><![CDATA[MILLISECOND]]></category>
		<category><![CDATA[NANOSECOND]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server 2016]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=5030</guid>

					<description><![CDATA[SQL Server 2016 introduced a new function for data operation which is DATEDIFF_BIG(). Previously, we were unable to take date difference in format of MICROSECOND, NANOSECOND, MILLISECOND using DATADIFF(). In our new module, we need to make time difference in a microsecond as we are dealing with financial transactions. If you are using DATEDIFF() and [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond%2F&amp;linkname=SQL%20Server%202016%3A%20New%20DATEDIFF_BIG%20to%20take%20difference%20for%20MICROSECOND%2C%20NANOSECOND%2C%20MILLISECOND" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond%2F&amp;linkname=SQL%20Server%202016%3A%20New%20DATEDIFF_BIG%20to%20take%20difference%20for%20MICROSECOND%2C%20NANOSECOND%2C%20MILLISECOND" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond%2F&amp;linkname=SQL%20Server%202016%3A%20New%20DATEDIFF_BIG%20to%20take%20difference%20for%20MICROSECOND%2C%20NANOSECOND%2C%20MILLISECOND" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond%2F&amp;linkname=SQL%20Server%202016%3A%20New%20DATEDIFF_BIG%20to%20take%20difference%20for%20MICROSECOND%2C%20NANOSECOND%2C%20MILLISECOND" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond%2F&amp;linkname=SQL%20Server%202016%3A%20New%20DATEDIFF_BIG%20to%20take%20difference%20for%20MICROSECOND%2C%20NANOSECOND%2C%20MILLISECOND" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond%2F&amp;linkname=SQL%20Server%202016%3A%20New%20DATEDIFF_BIG%20to%20take%20difference%20for%20MICROSECOND%2C%20NANOSECOND%2C%20MILLISECOND" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F04%2Fsql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond%2F&#038;title=SQL%20Server%202016%3A%20New%20DATEDIFF_BIG%20to%20take%20difference%20for%20MICROSECOND%2C%20NANOSECOND%2C%20MILLISECOND" data-a2a-url="https://www.dbrnd.com/2017/04/sql-server-2016-new-datediff_big-to-take-difference-for-microsecond-nanosecond-millisecond/" data-a2a-title="SQL Server 2016: New DATEDIFF_BIG to take difference for MICROSECOND, NANOSECOND, MILLISECOND"></a></p><p>SQL Server 2016 introduced a new function for data operation which is DATEDIFF_BIG().<br />
Previously, we were unable to take date difference in format of MICROSECOND, NANOSECOND, MILLISECOND using DATADIFF().<br />
In our new module, we need to make time difference in a microsecond as we are dealing with financial transactions.</p>
<blockquote><p>If you are using DATEDIFF() and try to get date difference in format of MICROSECOND, NANOSECOND, MILLISECOND, you will get a below error.<br />
Because the return value from the DATEDIFF function is an integer with a range of -2^31 to 2^31 &#8211; 1.</p></blockquote>
<pre class="crayon-plain-tag">SELECT DATEDIFF(MICROSECOND,'2015-08-26 09:12:56.147488','2016-10-30 08:09:14.965238')
SELECT DATEDIFF(NANOSECOND,'2015-08-26 09:12:56.147488','2016-10-30 08:09:14.965238')
SELECT DATEDIFF(MILLISECOND,'2015-08-26 09:12:56.147488','2016-10-30 08:09:14.965238')</pre> </p>
<pre class="crayon-plain-tag">Msg 535, Level 16, State 0, Line 1
The datediff function resulted in an overflow. The number of dateparts separating two date/time instances is too large. Try to use datediff with a less precise datepart.</pre> </p>
<p>In SQL Server 2016, we can use DATEDIFF_BIG() to take date difference in format of MICROSECOND, NANOSECOND, MILLISECOND.</p><pre class="crayon-plain-tag">SELECT DATEDIFF_BIG(MICROSECOND,'2015-08-26 09:12:56.147488','2016-10-30 08:09:14.965238')
SELECT DATEDIFF_BIG(NANOSECOND,'2015-08-26 09:12:56.147488','2016-10-30 08:09:14.965238')
SELECT DATEDIFF_BIG(MILLISECOND,'2015-08-26 09:12:56.147488','2016-10-30 08:09:14.965238')</pre><p> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
