<?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>BlogmyQuery - BMQ &#187; DateFirst</title>
	<atom:link href="http://blogmyquery.com/index.php/tag/datefirst/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogmyquery.com</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 15:17:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DateFirst in SQL Server</title>
		<link>http://blogmyquery.com/index.php/2009/07/datefirst-in-sql-server/</link>
		<comments>http://blogmyquery.com/index.php/2009/07/datefirst-in-sql-server/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 20:07:28 +0000</pubDate>
		<dc:creator>kranthi</dc:creator>
				<category><![CDATA[Sqlserver]]></category>
		<category><![CDATA[DateFirst]]></category>
		<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://blogmyquery.com/?p=600</guid>
		<description><![CDATA[Select @@DateFirst

returns the current value, for a session, of SET DATE FIRST, i.e it returns first day of week, TinyInt Value from 1 through 7 representing Monday to Sunday as shown Below. ]]></description>
			<content:encoded><![CDATA[<pre class="brush: plain;">
Select @@DateFirst
</pre>
<p>returns the current value, for a session, of SET DATE FIRST, i.e it returns first day of week, TinyInt Value from 1 through 7 representing Monday to Sunday as shown Below. </p>
<pre class="brush: plain;">
1 for Monday
2 for Tuesday
3 for Wednesday
4 for Thursday
5 for Friday
6 for Saturday
7 for Sunday
</pre>
<p>For Example, If the first day of week is Sunday (US) , Then @@DateFirst would return 7.</p>
<p>If the first day of week is Monday (Europe), Then @@DateFirst Would return 1.</p>
<pre class="brush: plain;">
SET DateFirst = 3
</pre>
<p>The above statement would set Wednesday as first day of the week for the current Session.</p>
<p>&#8216;July 1st 2009 is a wednesday</p>
<pre class="brush: plain;">
SET DateFirst = 1 -- or SET LANGUAGE Italian;
Select DATEPART(dw, '20090701')
</pre>
<p>would return 3 (since Wednesday is 3rd day from Monday)</p>
<pre class="brush: plain;">
SET DateFirst = 7 -- or SET LANGUAGE us_english;
Select DATEPART(dw, '20090701')
</pre>
<p>would return 4 (since Wednesday is 4th day from Sunday)</p>
<p>DATEPART return the weekday according @@DateFirst.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogmyquery.com/index.php/2009/07/datefirst-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

