<?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>Bradley M. Law &#187; SQL</title>
	<atom:link href="http://bradleymlaw.com/wp/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://bradleymlaw.com/wp</link>
	<description>Technology, CRM and Stuff. Thoughts within thoughts...within thoughts.</description>
	<lastBuildDate>Wed, 07 Sep 2011 11:40:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Javascript &#8211; Writing Calculated CRM field to the database</title>
		<link>http://bradleymlaw.com/wp/2009/01/24/javascript-writing-calculated-crm-field-to-the-database/</link>
		<comments>http://bradleymlaw.com/wp/2009/01/24/javascript-writing-calculated-crm-field-to-the-database/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 21:35:01 +0000</pubDate>
		<dc:creator>bradlaw</dc:creator>
				<category><![CDATA[CRM 4.0]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://bradleymlaw.com/wp/?p=10</guid>
		<description><![CDATA[//force the result to the database crmForm.all.DesiredField.ForceSubmit = true]]></description>
			<content:encoded><![CDATA[<p>//force the result to the database<br />
crmForm.all.DesiredField.ForceSubmit = true</p>
]]></content:encoded>
			<wfw:commentRss>http://bradleymlaw.com/wp/2009/01/24/javascript-writing-calculated-crm-field-to-the-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Date Functions</title>
		<link>http://bradleymlaw.com/wp/2009/01/11/sql-date-functions/</link>
		<comments>http://bradleymlaw.com/wp/2009/01/11/sql-date-functions/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 18:57:08 +0000</pubDate>
		<dc:creator>bradlaw</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://bradleymlaw.com/wp/?p=22</guid>
		<description><![CDATA[Sites with Date Formatting http://www.sql-server-helper.com/tips/date-formats.aspx http://www.blackwasp.co.uk/SQLDateTimeFormats.aspx http://www.mssqltips.com/tip.asp?tip=1145 Other Date Formats SELECT MONTH(CURRENT_TIMESTAMP);- Return a Month(6) SELECT DAY(CURRENT_TIMESTAMP);-Return a Day:(22) SELECT DATE(CURRENT_TIMESTAMP); - returns a date (2004-06-22) SELECT TIME(CURRENT_TIMESTAMP); - returns the time (10:33:11.840) SELECT DAYOFWEEK(CURRENT_TIMESTAMP); - returns a numeric value (1-7) SELECT DAYOFMONTH(CURRENT_TIMESTAMP); - returns a day of month (1-31) SELECT DAYOFYEAR(CURRENT_TIMESTAMP); - returns the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Sites with Date Formatting</strong></p>
<p>http://www.sql-server-helper.com/tips/date-formats.aspx</p>
<p>http://www.blackwasp.co.uk/SQLDateTimeFormats.aspx</p>
<p>http://www.mssqltips.com/tip.asp?tip=1145</p>
<p><strong>Other Date Formats</strong></p>
<pre class="brush: php; title: ;">SELECT MONTH(CURRENT_TIMESTAMP);- Return a Month(6)

SELECT DAY(CURRENT_TIMESTAMP);-Return a Day:(22) 

SELECT DATE(CURRENT_TIMESTAMP); - returns a date (2004-06-22)

SELECT TIME(CURRENT_TIMESTAMP); - returns the time (10:33:11.840)

SELECT DAYOFWEEK(CURRENT_TIMESTAMP); - returns a numeric value (1-7)

SELECT DAYOFMONTH(CURRENT_TIMESTAMP); - returns a day of month (1-31)

SELECT DAYOFYEAR(CURRENT_TIMESTAMP); - returns the day of the year (1-365)

SELECT MONTHNAME(CURRENT_TIMESTAMP); - returns the month name (January - December)

SELECT DAYNAME(CURRENT_TIMESTAMP); - returns the name of the day (Sunday - Saturday)

SELECT WEEK(CURRENT_TIMESTAMP); - returns number of the week (1-53)

 Last 30 days
BETWEEN dateadd(month, -1, getdate()) and getdate()

This month
DateTime between  (DATEADD(m, DATEDIFF(m, 0, getdate()) , 0)) AND (DATEADD(dd, DATEDIFF(dd,0, getdate()), 0))

Last Month
DateTime between  (DATEADD(m, DATEDIFF(m, 0, getdate()) -1 , 0)) AND (DATEADD(m, DATEDIFF(m, 0, getdate()) , 0))

Yesterday
DateTime BETWEEN (DATEADD(dd, DATEDIFF(dd,0, getdate()) -1, 0)) AND (DATEADD(dd, DATEDIFF(dd,0, getdate()) , 0)))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bradleymlaw.com/wp/2009/01/11/sql-date-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Find the last day of the month</title>
		<link>http://bradleymlaw.com/wp/2009/01/10/find-the-last-day-of-the-month/</link>
		<comments>http://bradleymlaw.com/wp/2009/01/10/find-the-last-day-of-the-month/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 16:27:59 +0000</pubDate>
		<dc:creator>bradlaw</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://bradleymlaw.com/wp/?p=12</guid>
		<description><![CDATA[Often I need to produce data for a SQL Reporting Services report where the data is filtered by the last day of the month. I found a solution to this query at this site HERE: ----Last Day of Previous Month SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0)) LastDay_PreviousMonth ----Last Day of Current Month SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0)) LastDay_CurrentMonth ----Last Day [...]]]></description>
			<content:encoded><![CDATA[<p>Often I need to produce data for a SQL Reporting Services report where the data is filtered by the last day of the month. I found a solution to this query at this site <a href="http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/">HERE</a>:</p>
<p><code>----Last Day of Previous Month<br />
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))<br />
LastDay_PreviousMonth<br />
----Last Day of Current Month<br />
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))<br />
LastDay_CurrentMonth<br />
----Last Day of Next Month<br />
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+2,0))<br />
LastDay_NextMonth</code></p>
]]></content:encoded>
			<wfw:commentRss>http://bradleymlaw.com/wp/2009/01/10/find-the-last-day-of-the-month/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

