<?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>tensixtyone &#187; sql server 2005</title>
	<atom:link href="http://tensixtyone.com/tags/sql-server-2005/feed" rel="self" type="application/rss+xml" />
	<link>http://tensixtyone.com</link>
	<description>Rants of Andrew Williams / Nik_Doof</description>
	<lastBuildDate>Fri, 25 Jun 2010 10:58:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SQL Server Last Full Week</title>
		<link>http://tensixtyone.com/perma/sql-server-last-full-week</link>
		<comments>http://tensixtyone.com/perma/sql-server-last-full-week#comments</comments>
		<pubDate>Wed, 17 Sep 2008 13:12:21 +0000</pubDate>
		<dc:creator>Andrew Williams</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[sql server 2005]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://tensixtyone.com/?p=392</guid>
		<description><![CDATA[While writing a new report today I&#8217;ve been drove mad while creating a dynamic query that selects the last full week. So here is the code for SQL Server, to save anyone else the pain: dateadd(dd,0, datediff(dd,0, dateadd(day,-1*datepart(weekday,getdate())+1,dateadd(week,-1,getdate())) )) dateadd(dd,0, datediff(dd,0, dateadd(day,7,dateadd(day,-1*datepart(weekday,getdate()),dateadd(week,-1,getdate()))) ))]]></description>
			<content:encoded><![CDATA[<p>While writing a new report today I&#8217;ve been drove mad while creating a dynamic query that selects the last full week. So here is the code for SQL Server, to save anyone else the pain:</p>
<pre>dateadd(dd,0, datediff(dd,0,
   dateadd(day,-1*datepart(weekday,getdate())+1,dateadd(week,-1,getdate()))
))
dateadd(dd,0, datediff(dd,0,
   dateadd(day,7,dateadd(day,-1*datepart(weekday,getdate()),dateadd(week,-1,getdate())))
))</pre>
]]></content:encoded>
			<wfw:commentRss>http://tensixtyone.com/perma/sql-server-last-full-week/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
