<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for I grok, therefore I am</title>
	<atom:link href="http://blog.3234.net/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.3234.net</link>
	<description>Developing Data-Centric Applications</description>
	<lastBuildDate>Wed, 20 Jul 2011 17:34:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on INSERT INTO &amp; Temp Table Creation by Joshua Lynn</title>
		<link>http://blog.3234.net/20091015/insert-into-temp-table-creation/comment-page-1/#comment-2497</link>
		<dc:creator>Joshua Lynn</dc:creator>
		<pubDate>Wed, 20 Jul 2011 17:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3234.net/?p=163#comment-2497</guid>
		<description>Credit where credit is due.  I used this sproc again today.

tnx Matt</description>
		<content:encoded><![CDATA[<p>Credit where credit is due.  I used this sproc again today.</p>
<p>tnx Matt</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on First Day of Current Month by Joshua</title>
		<link>http://blog.3234.net/20100303/first-day-of-current-month/comment-page-1/#comment-322</link>
		<dc:creator>Joshua</dc:creator>
		<pubDate>Mon, 15 Mar 2010 14:20:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3234.net/?p=216#comment-322</guid>
		<description>&quot;Well I wouldn&#039;t have done it that way.&quot; - Someone to be named later

Try this instead for a more efficient solution:

SELECT 
	  GETDATE() AS CurrentDate
	, DATEDIFF(mm,0,GETDATE()) AS NumberOfMonthsSince
	, DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0) AS FirstOfMonth
	, DateAdd(dd,-1,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)) AS EndOfPreviousMonth
	, DateAdd(ms,-3,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)) AS EndOfPreviousMonth_Exact
	

The CONVERT(VARCHAR(10) part is good if you want to output just the date without the time as text.  But a bit expensive to force two type conversions when the same trick with DATEADD and DATEDIFF can work without the type conversions.</description>
		<content:encoded><![CDATA[<p>&#8220;Well I wouldn&#8217;t have done it that way.&#8221; &#8211; Someone to be named later</p>
<p>Try this instead for a more efficient solution:</p>
<p>SELECT<br />
	  GETDATE() AS CurrentDate<br />
	, DATEDIFF(mm,0,GETDATE()) AS NumberOfMonthsSince<br />
	, DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0) AS FirstOfMonth<br />
	, DateAdd(dd,-1,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)) AS EndOfPreviousMonth<br />
	, DateAdd(ms,-3,DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)) AS EndOfPreviousMonth_Exact</p>
<p>The CONVERT(VARCHAR(10) part is good if you want to output just the date without the time as text.  But a bit expensive to force two type conversions when the same trick with DATEADD and DATEDIFF can work without the type conversions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL Server Bug &#8211; Synonyns by PocjekJoshua</title>
		<link>http://blog.3234.net/20091203/sql-server-bug-synonyns/comment-page-1/#comment-69</link>
		<dc:creator>PocjekJoshua</dc:creator>
		<pubDate>Mon, 07 Dec 2009 01:17:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3234.net/?p=189#comment-69</guid>
		<description>Did not know that.  Any Idea what happens if you create a linked server back to the same server.  I suspect it would work but you would loose all the conveniences of a of cross database connections.

In other words, for development, it may be a good idea to use the synonym with a linked server back to the same server to ensure while testing you don&#039;t accidental do something that won&#039;t work in production like calling a UDF, or trying to pass XML or a NVARChAR(MAX).

Just a thought.</description>
		<content:encoded><![CDATA[<p>Did not know that.  Any Idea what happens if you create a linked server back to the same server.  I suspect it would work but you would loose all the conveniences of a of cross database connections.</p>
<p>In other words, for development, it may be a good idea to use the synonym with a linked server back to the same server to ensure while testing you don&#8217;t accidental do something that won&#8217;t work in production like calling a UDF, or trying to pass XML or a NVARChAR(MAX).</p>
<p>Just a thought.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INSERT INTO &amp; Temp Table Creation by SQL Server: Temporary Table Scripting &#124; I grok, therefore I am</title>
		<link>http://blog.3234.net/20091015/insert-into-temp-table-creation/comment-page-1/#comment-29</link>
		<dc:creator>SQL Server: Temporary Table Scripting &#124; I grok, therefore I am</dc:creator>
		<pubDate>Fri, 16 Oct 2009 13:42:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.3234.net/?p=163#comment-29</guid>
		<description>[...] New version: here [...]</description>
		<content:encoded><![CDATA[<p>[...] New version: here [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

