<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Find Last Day of Any Month &#8211; Current Previous Next</title>
	<atom:link href="http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 12 Feb 2012 09:22:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: revathi</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-250934</link>
		<dc:creator><![CDATA[revathi]]></dc:creator>
		<pubDate>Fri, 10 Feb 2012 11:26:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-250934</guid>
		<description><![CDATA[Write a function to return total experience in ,months/years according to the given input(M/Y). Use this in a SP to get the details of a person with his name, experience.]]></description>
		<content:encoded><![CDATA[<p>Write a function to return total experience in ,months/years according to the given input(M/Y). Use this in a SP to get the details of a person with his name, experience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tungrus</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-243574</link>
		<dc:creator><![CDATA[Tungrus]]></dc:creator>
		<pubDate>Wed, 25 Jan 2012 17:57:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-243574</guid>
		<description><![CDATA[Holy crap!

Can&#039;t you just do this to get the last date of the month? 

SELECT DATEADD(d, -1, DATEADD(M, DATEDIFF(M, 0, @SomeDate)+1, 0)) AS NewDate]]></description>
		<content:encoded><![CDATA[<p>Holy crap!</p>
<p>Can&#8217;t you just do this to get the last date of the month? </p>
<p>SELECT DATEADD(d, -1, DATEADD(M, DATEDIFF(M, 0, @SomeDate)+1, 0)) AS NewDate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samyuktha</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-236763</link>
		<dc:creator><![CDATA[Samyuktha]]></dc:creator>
		<pubDate>Fri, 13 Jan 2012 19:49:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-236763</guid>
		<description><![CDATA[Hi Pinal,

I want a function to calculate the last day of all the months based on Year number and Month number but not based on GetDate() that gives the current Date.

Please help me out.

Thanks in Advance,
Samyuktha]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I want a function to calculate the last day of all the months based on Year number and Month number but not based on GetDate() that gives the current Date.</p>
<p>Please help me out.</p>
<p>Thanks in Advance,<br />
Samyuktha</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kaushal</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-234100</link>
		<dc:creator><![CDATA[kaushal]]></dc:creator>
		<pubDate>Mon, 09 Jan 2012 09:24:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-234100</guid>
		<description><![CDATA[Sir  I want  to calculate previous months records from my table .
like now is month january ,then i want to calculate dec 2011 
count records .


Please help me]]></description>
		<content:encoded><![CDATA[<p>Sir  I want  to calculate previous months records from my table .<br />
like now is month january ,then i want to calculate dec 2011<br />
count records .</p>
<p>Please help me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joeb</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-231531</link>
		<dc:creator><![CDATA[Joeb]]></dc:creator>
		<pubDate>Thu, 05 Jan 2012 00:38:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-231531</guid>
		<description><![CDATA[This is great, thanks! Only thing when copying note that:

...@monthOfInterest)) )) – @dayOfInterest)%7,....

Should be a Minus sign in there but if you direct-copy it, it is something slightly longer than a minus sign, so just replace.]]></description>
		<content:encoded><![CDATA[<p>This is great, thanks! Only thing when copying note that:</p>
<p>&#8230;@monthOfInterest)) )) – @dayOfInterest)%7,&#8230;.</p>
<p>Should be a Minus sign in there but if you direct-copy it, it is something slightly longer than a minus sign, so just replace.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hitesh</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-226011</link>
		<dc:creator><![CDATA[Hitesh]]></dc:creator>
		<pubDate>Mon, 26 Dec 2011 08:21:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-226011</guid>
		<description><![CDATA[hi ,
I m new to sql server.

I have question like i want to display records of last 30 days from currentDate with additional column say DayNo,monthNo,yearNo which contains only day,month,year...


Can anybody help me out...


Thanks .]]></description>
		<content:encoded><![CDATA[<p>hi ,<br />
I m new to sql server.</p>
<p>I have question like i want to display records of last 30 days from currentDate with additional column say DayNo,monthNo,yearNo which contains only day,month,year&#8230;</p>
<p>Can anybody help me out&#8230;</p>
<p>Thanks .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wildan</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-222495</link>
		<dc:creator><![CDATA[Wildan]]></dc:creator>
		<pubDate>Wed, 21 Dec 2011 01:22:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-222495</guid>
		<description><![CDATA[Thank&#039;s a lot]]></description>
		<content:encoded><![CDATA[<p>Thank&#8217;s a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chitra kumar khadka</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-210502</link>
		<dc:creator><![CDATA[chitra kumar khadka]]></dc:creator>
		<pubDate>Sun, 04 Dec 2011 08:11:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-210502</guid>
		<description><![CDATA[ok don&#039;t worry about the problem. 
Copy the below code in your sql:
-----------------------------------------------------

declare @date datetime
set @date = &#039;09/25/2010&#039;
select DATEADD(DD, -DAY(DATEADD(DD, -DAY(@date),@date))+1,DATEADD(DD, -DAY(@date),@date))]]></description>
		<content:encoded><![CDATA[<p>ok don&#8217;t worry about the problem.<br />
Copy the below code in your sql:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>declare @date datetime<br />
set @date = &#8217;09/25/2010&#8242;<br />
select DATEADD(DD, -DAY(DATEADD(DD, -DAY(@date),@date))+1,DATEADD(DD, -DAY(@date),@date))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davos</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-200906</link>
		<dc:creator><![CDATA[Davos]]></dc:creator>
		<pubDate>Mon, 21 Nov 2011 05:34:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-200906</guid>
		<description><![CDATA[Steve: Arthur&#039;s code does work, you just need to replace the single quotes with real single quotes. Unfortunately the html reply box on this page alters single quotes to this symbol &#039;

Still, it&#039;s not elegant as you have to supply both the year and month, and the datatype returned is a string so overall not very useful.]]></description>
		<content:encoded><![CDATA[<p>Steve: Arthur&#8217;s code does work, you just need to replace the single quotes with real single quotes. Unfortunately the html reply box on this page alters single quotes to this symbol &#8216;</p>
<p>Still, it&#8217;s not elegant as you have to supply both the year and month, and the datatype returned is a string so overall not very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-181600</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Fri, 21 Oct 2011 13:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-181600</guid>
		<description><![CDATA[Arthur, You are an [removed word]. Your method of calculating the last day of the month does not work. You should test your code before you post it for the world to see. I have wasted so much time attempting to implement your solution. Thanks]]></description>
		<content:encoded><![CDATA[<p>Arthur, You are an [removed word]. Your method of calculating the last day of the month does not work. You should test your code before you post it for the world to see. I have wasted so much time attempting to implement your solution. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chinna</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-179158</link>
		<dc:creator><![CDATA[chinna]]></dc:creator>
		<pubDate>Sat, 15 Oct 2011 09:22:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-179158</guid>
		<description><![CDATA[use  this and you will get select CONVERT(DATE, GETDATE(), 102)]]></description>
		<content:encoded><![CDATA[<p>use  this and you will get select CONVERT(DATE, GETDATE(), 102)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hamdy</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-175291</link>
		<dc:creator><![CDATA[hamdy]]></dc:creator>
		<pubDate>Wed, 05 Oct 2011 07:00:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-175291</guid>
		<description><![CDATA[thx alot]]></description>
		<content:encoded><![CDATA[<p>thx alot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sandeep</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-170886</link>
		<dc:creator><![CDATA[Sandeep]]></dc:creator>
		<pubDate>Fri, 23 Sep 2011 10:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-170886</guid>
		<description><![CDATA[I need to find records dated last day of the month..any suggestions?]]></description>
		<content:encoded><![CDATA[<p>I need to find records dated last day of the month..any suggestions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-158224</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 07:41:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-158224</guid>
		<description><![CDATA[You need to have a calender table for this and query from that table]]></description>
		<content:encoded><![CDATA[<p>You need to have a calender table for this and query from that table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AMAN</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-158179</link>
		<dc:creator><![CDATA[AMAN]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 06:13:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-158179</guid>
		<description><![CDATA[how i can show all months of a year]]></description>
		<content:encoded><![CDATA[<p>how i can show all months of a year</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AMAN</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-158172</link>
		<dc:creator><![CDATA[AMAN]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 06:09:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-158172</guid>
		<description><![CDATA[Sir how can i show all months of a year ????]]></description>
		<content:encoded><![CDATA[<p>Sir how can i show all months of a year ????</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naresh gupta</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-154991</link>
		<dc:creator><![CDATA[Naresh gupta]]></dc:creator>
		<pubDate>Mon, 08 Aug 2011 10:31:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-154991</guid>
		<description><![CDATA[Hi
thanks Pinal dave for solution

Mr evisoft 
you can use here 

select dateadd(d,datediff(d,0,dateadd(s,-1,dateadd(m,datediff(m,0,getdate())+1,0))),0)

try it]]></description>
		<content:encoded><![CDATA[<p>Hi<br />
thanks Pinal dave for solution</p>
<p>Mr evisoft<br />
you can use here </p>
<p>select dateadd(d,datediff(d,0,dateadd(s,-1,dateadd(m,datediff(m,0,getdate())+1,0))),0)</p>
<p>try it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karthika</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-154911</link>
		<dc:creator><![CDATA[karthika]]></dc:creator>
		<pubDate>Mon, 08 Aug 2011 06:43:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-154911</guid>
		<description><![CDATA[IF(DATEPART(dd,GETDATE())=(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#039;16&#039;)
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR,GETDATE(),112),1,6)+&#039;16&#039;)
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))
			AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#039;16&#039;)
			AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR,GETDATE(),112),1,6)+&#039;16&#039;)
		AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) &lt;=CONVERT(VARCHAR,GETDATE(),112) GROUP BY VCR_PAY_TO
	END	




--UNION ALL


IF(DATEPART(dd,GETDATE())=(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#039;16&#039;)
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#039;16&#039;)
			AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR,GETDATE(),112),1,6)+&#039;16&#039;)
				AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))
		AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) &lt;=CONVERT(VARCHAR,GETDATE(),112) GROUP BY VCR_PAY_TO
	END	


hi all, i need to make union this two if condition Queries with groupby condition,
pls help...... Thanks in advance]]></description>
		<content:encoded><![CDATA[<p>IF(DATEPART(dd,GETDATE())=(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))<br />
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#8217;16&#8242;)<br />
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR,GETDATE(),112),1,6)+&#8217;16&#8242;)<br />
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))<br />
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))<br />
			AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#8217;16&#8242;)<br />
			AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR,GETDATE(),112),1,6)+&#8217;16&#8242;)<br />
		AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) &lt;=CONVERT(VARCHAR,GETDATE(),112) GROUP BY VCR_PAY_TO<br />
	END	</p>
<p>&#8211;UNION ALL</p>
<p>IF(DATEPART(dd,GETDATE())=(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))<br />
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#8217;16&#8242;)<br />
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(m,0,getdate())-1,0),112),1,6)+&#8217;16&#8242;)<br />
			AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT SUBSTRING(CONVERT(VARCHAR,GETDATE(),112),1,6)+&#8217;16&#8242;)<br />
				AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))<br />
					AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) =(SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),112))<br />
		AND  CONVERT(VARCHAR,VCR_VOUCHER_DT,112) &lt;=CONVERT(VARCHAR,GETDATE(),112) GROUP BY VCR_PAY_TO<br />
	END	</p>
<p>hi all, i need to make union this two if condition Queries with groupby condition,<br />
pls help&#8230;&#8230; Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yatin</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-150141</link>
		<dc:creator><![CDATA[Yatin]]></dc:creator>
		<pubDate>Sat, 23 Jul 2011 06:08:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-150141</guid>
		<description><![CDATA[Q1) Given Month, Year and Day.
List out all the &quot;Monday&quot; dates of current month and year

Q2) Suppose loan has been taken on 1-Jan-2001 and after exactly One Month the Due will come for Installment payment (i.e. on 1-Feb-2001)
 So find out the Due date of the Installment if on any random date loan is given]]></description>
		<content:encoded><![CDATA[<p>Q1) Given Month, Year and Day.<br />
List out all the &#8220;Monday&#8221; dates of current month and year</p>
<p>Q2) Suppose loan has been taken on 1-Jan-2001 and after exactly One Month the Due will come for Installment payment (i.e. on 1-Feb-2001)<br />
 So find out the Due date of the Installment if on any random date loan is given</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-149155</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 18 Jul 2011 13:50:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-149155</guid>
		<description><![CDATA[You need to check like this

if not exists(select * from table where date_col &gt;=@date1 and date_col&lt;dateadd(day,1,@date2))
insert statement]]></description>
		<content:encoded><![CDATA[<p>You need to check like this</p>
<p>if not exists(select * from table where date_col &gt;=@date1 and date_col&lt;dateadd(day,1,@date2))<br />
insert statement</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bipin</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-149143</link>
		<dc:creator><![CDATA[bipin]]></dc:creator>
		<pubDate>Mon, 18 Jul 2011 12:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-149143</guid>
		<description><![CDATA[i want date range of one month where any data entered between this month should not duplicate. if data entered after the month should allow to enter.]]></description>
		<content:encoded><![CDATA[<p>i want date range of one month where any data entered between this month should not duplicate. if data entered after the month should allow to enter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SqlQues</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-148235</link>
		<dc:creator><![CDATA[SqlQues]]></dc:creator>
		<pubDate>Thu, 14 Jul 2011 10:57:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-148235</guid>
		<description><![CDATA[No,
This would not give the desired result.
max(Updateddatetime)  will always give the latest date not all latest records.

Thanks for your reply.
Your query would only return the record with latest date but not all records.
In my case there are different products  and the product quantities are not updated on daily basis.
For eg.
I have 3 products ..
Updateddatetime                     Productname            qtyupdated
2011-01-28 10:25:47.253       p1                                10
2011-01-29 12:25:47.253       p1                                20
2011-02-20 10:25:47.253       p2                                10
2011-02-22 10:25:47.253       p2                                90
2011-02-20 10:25:47.253       p3                                50
2011-02-22 11:25:47.253       p3                                60

I should get the result as 
Updateddatetime                     Productname            qtyupdated

2011-01-29 12:25:47.253       p1                                20
2011-02-22 10:25:47.253       p2                                90
2011-02-22 11:25:47.253       p3                                60

that is latest of each record.
Please help]]></description>
		<content:encoded><![CDATA[<p>No,<br />
This would not give the desired result.<br />
max(Updateddatetime)  will always give the latest date not all latest records.</p>
<p>Thanks for your reply.<br />
Your query would only return the record with latest date but not all records.<br />
In my case there are different products  and the product quantities are not updated on daily basis.<br />
For eg.<br />
I have 3 products ..<br />
Updateddatetime                     Productname            qtyupdated<br />
2011-01-28 10:25:47.253       p1                                10<br />
2011-01-29 12:25:47.253       p1                                20<br />
2011-02-20 10:25:47.253       p2                                10<br />
2011-02-22 10:25:47.253       p2                                90<br />
2011-02-20 10:25:47.253       p3                                50<br />
2011-02-22 11:25:47.253       p3                                60</p>
<p>I should get the result as<br />
Updateddatetime                     Productname            qtyupdated</p>
<p>2011-01-29 12:25:47.253       p1                                20<br />
2011-02-22 10:25:47.253       p2                                90<br />
2011-02-22 11:25:47.253       p3                                60</p>
<p>that is latest of each record.<br />
Please help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-148010</link>
		<dc:creator><![CDATA[James]]></dc:creator>
		<pubDate>Wed, 13 Jul 2011 15:03:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-148010</guid>
		<description><![CDATA[How would I select all from a previous month?]]></description>
		<content:encoded><![CDATA[<p>How would I select all from a previous month?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-147998</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 13 Jul 2011 13:29:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-147998</guid>
		<description><![CDATA[select max(Updateddatetime) as   Updateddatetime,Productname, max(qtyupdated) as qtyupdated from table
group by Productname]]></description>
		<content:encoded><![CDATA[<p>select max(Updateddatetime) as   Updateddatetime,Productname, max(qtyupdated) as qtyupdated from table<br />
group by Productname</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SqlQues</title>
		<link>http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-147709</link>
		<dc:creator><![CDATA[SqlQues]]></dc:creator>
		<pubDate>Tue, 12 Jul 2011 14:01:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/#comment-147709</guid>
		<description><![CDATA[Thanks for your reply.
Your query would only return the record with latest date but not all records.
In my case there are different products  and the product quantities are not updated on daily basis.
For eg.
I have 3 products ..
Updateddatetime                     Productname            qtyupdated
2011-01-28 10:25:47.253       p1                                10
2011-01-29 12:25:47.253       p1                                20
2011-02-20 10:25:47.253       p2                                10
2011-02-22 10:25:47.253       p2                                90
2011-02-20 10:25:47.253       p3                                50
2011-02-22 11:25:47.253       p3                                60

I should get the result as 
Updateddatetime                     Productname            qtyupdated

2011-01-29 12:25:47.253       p1                                20
2011-02-22 10:25:47.253       p2                                90
2011-02-22 11:25:47.253       p3                                60

that is latest of each record.
Please help]]></description>
		<content:encoded><![CDATA[<p>Thanks for your reply.<br />
Your query would only return the record with latest date but not all records.<br />
In my case there are different products  and the product quantities are not updated on daily basis.<br />
For eg.<br />
I have 3 products ..<br />
Updateddatetime                     Productname            qtyupdated<br />
2011-01-28 10:25:47.253       p1                                10<br />
2011-01-29 12:25:47.253       p1                                20<br />
2011-02-20 10:25:47.253       p2                                10<br />
2011-02-22 10:25:47.253       p2                                90<br />
2011-02-20 10:25:47.253       p3                                50<br />
2011-02-22 11:25:47.253       p3                                60</p>
<p>I should get the result as<br />
Updateddatetime                     Productname            qtyupdated</p>
<p>2011-01-29 12:25:47.253       p1                                20<br />
2011-02-22 10:25:47.253       p2                                90<br />
2011-02-22 11:25:47.253       p3                                60</p>
<p>that is latest of each record.<br />
Please help</p>
]]></content:encoded>
	</item>
</channel>
</rss>

