<?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; UDF &#8211; User Defined Function &#8211; Get Number of Days in Month</title>
	<atom:link href="http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 10 Feb 2012 02:12:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: yoga</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-197134</link>
		<dc:creator><![CDATA[yoga]]></dc:creator>
		<pubDate>Wed, 16 Nov 2011 19:20:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-197134</guid>
		<description><![CDATA[yoga..

How I create UDF for already created table column.
Must any one answer me...]]></description>
		<content:encoded><![CDATA[<p>yoga..</p>
<p>How I create UDF for already created table column.<br />
Must any one answer me&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ankit</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-163863</link>
		<dc:creator><![CDATA[ankit]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 06:50:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-163863</guid>
		<description><![CDATA[Get Month Name using UDF

CREATE FUNCTION dbo.GetMonthName(@MonthNumber tinyint)
RETURNS varchar(15)
AS 
BEGIN
DECLARE @MonthName varchar(15) 
SET @MonthName = DateName( Month , DateAdd( Month , @MonthNumber , 0 ) - 1 )
RETURN @MonthName
END

Execute it: SELECT dbo.GetMonthName(3)]]></description>
		<content:encoded><![CDATA[<p>Get Month Name using UDF</p>
<p>CREATE FUNCTION dbo.GetMonthName(@MonthNumber tinyint)<br />
RETURNS varchar(15)<br />
AS<br />
BEGIN<br />
DECLARE @MonthName varchar(15)<br />
SET @MonthName = DateName( Month , DateAdd( Month , @MonthNumber , 0 ) &#8211; 1 )<br />
RETURN @MonthName<br />
END</p>
<p>Execute it: SELECT dbo.GetMonthName(3)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Day 4 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-145626</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Frequently Asked Questions – Day 4 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Mon, 04 Jul 2011 01:31:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-145626</guid>
		<description><![CDATA[[...] A multi-statement table-value user-defined function returns a table, and it is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a T-SQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command, you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior encountered while using a stored procedure which can also return record sets. (Read here for example) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] A multi-statement table-value user-defined function returns a table, and it is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a T-SQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command, you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior encountered while using a stored procedure which can also return record sets. (Read here for example) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sandeep</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-88169</link>
		<dc:creator><![CDATA[sandeep]]></dc:creator>
		<pubDate>Sat, 18 Sep 2010 00:54:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-88169</guid>
		<description><![CDATA[Hello Friends,
This site was very informative, i have an issue, would be glad if you can help me.
The issue that i have to write a user defined funtion 

format of dtActivityStartDate/dtActivityFinishDate: 2010-09-17 14:50:51.150  Note: Both dtActivityStartDate/dtActivityFinishDate

vcActivityName = Process Request 

usdFuncTimeCalc (vcActivityName,dtActivityStartDate, dtActivityFinishDate)

 i need to calculate time elasped for that type of activity  following are the rules:

(If Process Request is the activity) 

        Working Days: Monday through Saturday 
        Hours of Operation: 9AM - 5PM 

 only working hours of day need to the counted like for example if it is sep 15  11 Am is dtActivityStartDate  &amp; Sep 17 is dtActivityFinishDate is 10 Am. then time elapsed is 11am  to 5pm on sep 15 , 9 to 5 on sep 16 &amp; 9 to 10 on sep 17 so total should be 
6+ 8 + 1 = 15 hours + minutes.

format of date time: 2010-09-17 14:50:51.150 

vcActivityName = Process Request]]></description>
		<content:encoded><![CDATA[<p>Hello Friends,<br />
This site was very informative, i have an issue, would be glad if you can help me.<br />
The issue that i have to write a user defined funtion </p>
<p>format of dtActivityStartDate/dtActivityFinishDate: 2010-09-17 14:50:51.150  Note: Both dtActivityStartDate/dtActivityFinishDate</p>
<p>vcActivityName = Process Request </p>
<p>usdFuncTimeCalc (vcActivityName,dtActivityStartDate, dtActivityFinishDate)</p>
<p> i need to calculate time elasped for that type of activity  following are the rules:</p>
<p>(If Process Request is the activity) </p>
<p>        Working Days: Monday through Saturday<br />
        Hours of Operation: 9AM &#8211; 5PM </p>
<p> only working hours of day need to the counted like for example if it is sep 15  11 Am is dtActivityStartDate  &amp; Sep 17 is dtActivityFinishDate is 10 Am. then time elapsed is 11am  to 5pm on sep 15 , 9 to 5 on sep 16 &amp; 9 to 10 on sep 17 so total should be<br />
6+ 8 + 1 = 15 hours + minutes.</p>
<p>format of date time: 2010-09-17 14:50:51.150 </p>
<p>vcActivityName = Process Request</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-81172</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Thu, 22 Jul 2010 00:33:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-81172</guid>
		<description><![CDATA[@Pavan.

Major Difference between Function and Procedure.

Function should return a value where as procedure might or might not.

You cannot run select statement on procedures where as you can run a select statement on (Table) functions.

You cannot perform many T-SQL operation inside a function where as you perform many more T-SQL Operations inside a procedure. 

~Peace.]]></description>
		<content:encoded><![CDATA[<p>@Pavan.</p>
<p>Major Difference between Function and Procedure.</p>
<p>Function should return a value where as procedure might or might not.</p>
<p>You cannot run select statement on procedures where as you can run a select statement on (Table) functions.</p>
<p>You cannot perform many T-SQL operation inside a function where as you perform many more T-SQL Operations inside a procedure. </p>
<p>~Peace.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavan</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-81093</link>
		<dc:creator><![CDATA[Pavan]]></dc:creator>
		<pubDate>Wed, 21 Jul 2010 11:51:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-81093</guid>
		<description><![CDATA[Hi,

what are the major difference between functions and Procedures?]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>what are the major difference between functions and Procedures?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivek</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-80417</link>
		<dc:creator><![CDATA[vivek]]></dc:creator>
		<pubDate>Thu, 15 Jul 2010 18:11:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-80417</guid>
		<description><![CDATA[How do i find number of sundays in given month?]]></description>
		<content:encoded><![CDATA[<p>How do i find number of sundays in given month?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anand</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-74432</link>
		<dc:creator><![CDATA[Anand]]></dc:creator>
		<pubDate>Wed, 02 Jun 2010 17:25:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-74432</guid>
		<description><![CDATA[I want to subscribe]]></description>
		<content:encoded><![CDATA[<p>I want to subscribe</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarika</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-62734</link>
		<dc:creator><![CDATA[Sarika]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 12:27:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-62734</guid>
		<description><![CDATA[We can write this also instead of case when if someone feels difficulty in using case statements then it will be easy for them using this.......................
create function dbo.retdates(@date datetime)
returns int
as
begin
declare @out int
if month (@date) in(1,3,5,7,8,10,12)
set @out=31
else if month(@date) in(4,6,9,11)
set @out=30
else if ((year(@date)%4=0) and (year(@date)%100!=0)) or (year(@date)%400=0)
set @out=29
else 
set @out=28
return @out
end
go]]></description>
		<content:encoded><![CDATA[<p>We can write this also instead of case when if someone feels difficulty in using case statements then it will be easy for them using this&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br />
create function dbo.retdates(@date datetime)<br />
returns int<br />
as<br />
begin<br />
declare @out int<br />
if month (@date) in(1,3,5,7,8,10,12)<br />
set @out=31<br />
else if month(@date) in(4,6,9,11)<br />
set @out=30<br />
else if ((year(@date)%4=0) and (year(@date)%100!=0)) or (year(@date)%400=0)<br />
set @out=29<br />
else<br />
set @out=28<br />
return @out<br />
end<br />
go</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mrityunjay Ravi</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-61821</link>
		<dc:creator><![CDATA[Mrityunjay Ravi]]></dc:creator>
		<pubDate>Fri, 26 Feb 2010 09:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-61821</guid>
		<description><![CDATA[Hi expert,

You are excelent to write this function.

Thank you very much....................]]></description>
		<content:encoded><![CDATA[<p>Hi expert,</p>
<p>You are excelent to write this function.</p>
<p>Thank you very much&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-60721</link>
		<dc:creator><![CDATA[Madhivanan]]></dc:creator>
		<pubDate>Fri, 05 Feb 2010 14:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-60721</guid>
		<description><![CDATA[There are many ways

Here is one




declare @month int, @year int
select @month=2, @year=2009

select day(dateadd(day,-1,cast(@year*10000+(@month+1)*100+1 as char(8))))

Madhivanan]]></description>
		<content:encoded><![CDATA[<p>There are many ways</p>
<p>Here is one</p>
<p>declare @month int, @year int<br />
select @month=2, @year=2009</p>
<p>select day(dateadd(day,-1,cast(@year*10000+(@month+1)*100+1 as char(8))))</p>
<p>Madhivanan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chethan</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-59828</link>
		<dc:creator><![CDATA[chethan]]></dc:creator>
		<pubDate>Sat, 16 Jan 2010 07:20:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-59828</guid>
		<description><![CDATA[Very Informative site....]]></description>
		<content:encoded><![CDATA[<p>Very Informative site&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gourav</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51257</link>
		<dc:creator><![CDATA[Gourav]]></dc:creator>
		<pubDate>Fri, 24 Apr 2009 05:32:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51257</guid>
		<description><![CDATA[thanks bro... you hav done it....thank you very very much...
Regards
Gourav]]></description>
		<content:encoded><![CDATA[<p>thanks bro&#8230; you hav done it&#8230;.thank you very very much&#8230;<br />
Regards<br />
Gourav</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Tkatch</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51251</link>
		<dc:creator><![CDATA[Brian Tkatch]]></dc:creator>
		<pubDate>Thu, 23 Apr 2009 16:31:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51251</guid>
		<description><![CDATA[@gourav, here&#039;s a quick shot:
CREATE FUNCTION UDFDays(@mm tinyint,@yy smallint,@dyw varchar(9))
RETURNS TABLE
AS
 RETURN
 WITH
	Data(The_Date)
 AS
	(
	 SELECT CONVERT(smalldatetime, CAST(@mm as varchar(2)) + &#039;/01/&#039; + CAST(@YY as varchar(4)) , 101)
	),
	Days_In_Month
 AS
	(
	 SELECT The_Date, DATEADD(d, -1, DATEADD(m, 1, The_Date)) Next_Month FROM Data
	 UNION ALL
	 SELECT DATEADD(d, 1, The_Date), Next_Month FROM Days_In_Month WHERE The_Date &lt; Next_Month
	)
 SELECT
		DATEPART(d, The_Date) Day_Number
 FROM
		Days_In_Month
 WHERE
		DATENAME(dw, The_Date) =  @dyw;
GO]]></description>
		<content:encoded><![CDATA[<p>@gourav, here&#8217;s a quick shot:<br />
CREATE FUNCTION UDFDays(@mm tinyint,@yy smallint,@dyw varchar(9))<br />
RETURNS TABLE<br />
AS<br />
 RETURN<br />
 WITH<br />
	Data(The_Date)<br />
 AS<br />
	(<br />
	 SELECT CONVERT(smalldatetime, CAST(@mm as varchar(2)) + &#8216;/01/&#8217; + CAST(@YY as varchar(4)) , 101)<br />
	),<br />
	Days_In_Month<br />
 AS<br />
	(<br />
	 SELECT The_Date, DATEADD(d, -1, DATEADD(m, 1, The_Date)) Next_Month FROM Data<br />
	 UNION ALL<br />
	 SELECT DATEADD(d, 1, The_Date), Next_Month FROM Days_In_Month WHERE The_Date &lt; Next_Month<br />
	)<br />
 SELECT<br />
		DATEPART(d, The_Date) Day_Number<br />
 FROM<br />
		Days_In_Month<br />
 WHERE<br />
		DATENAME(dw, The_Date) =  @dyw;<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gourav</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51249</link>
		<dc:creator><![CDATA[Gourav]]></dc:creator>
		<pubDate>Thu, 23 Apr 2009 15:25:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51249</guid>
		<description><![CDATA[Re post:... slight mistake frm my side...

hi.. experts… i need a similar UDF…
my req is…. if i give 3 param’s to the UDF.. like..
“month,year and dayofweek” then i should get a list of that day fom the given month,year

ex. for April 2009 Sunday
UDFDays(@mm,@yy,@dyw)
i.e UDFDays(04,2009,’Sunday’)
then i should get list as.. 

5
12
19
26
i.e… the dates from the month given for weekday.. like for Apil 2009 Saturday..
i expect..esult as 

4
11
18
25

etc…
thanks in advance…]]></description>
		<content:encoded><![CDATA[<p>Re post:&#8230; slight mistake frm my side&#8230;</p>
<p>hi.. experts… i need a similar UDF…<br />
my req is…. if i give 3 param’s to the UDF.. like..<br />
“month,year and dayofweek” then i should get a list of that day fom the given month,year</p>
<p>ex. for April 2009 Sunday<br />
UDFDays(@mm,@yy,@dyw)<br />
i.e UDFDays(04,2009,’Sunday’)<br />
then i should get list as.. </p>
<p>5<br />
12<br />
19<br />
26<br />
i.e… the dates from the month given for weekday.. like for Apil 2009 Saturday..<br />
i expect..esult as </p>
<p>4<br />
11<br />
18<br />
25</p>
<p>etc…<br />
thanks in advance…</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gourav</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51247</link>
		<dc:creator><![CDATA[Gourav]]></dc:creator>
		<pubDate>Thu, 23 Apr 2009 14:38:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-51247</guid>
		<description><![CDATA[hi.. experts... i need a similar UDF...
my req is....  if i give 3 param&#039;s to the UDF.. like..
&quot;month,year and dayofweek&quot; then i should get a list of that day fom the given month,year

ex.  for April 2009 Sunday 
 UDFDays(@mm,@yy,@dyw) 
i.e UDFDays(04,2009,&#039;Sunday&#039;)
then i should get list as.. 

6
13
20
27

i.e... the dates from the month given for weekday..  like for Apil 2009 Saturday.. 
i expect..esult as 

5
12
19
26

etc...
thanks in advance...]]></description>
		<content:encoded><![CDATA[<p>hi.. experts&#8230; i need a similar UDF&#8230;<br />
my req is&#8230;.  if i give 3 param&#8217;s to the UDF.. like..<br />
&#8220;month,year and dayofweek&#8221; then i should get a list of that day fom the given month,year</p>
<p>ex.  for April 2009 Sunday<br />
 UDFDays(@mm,@yy,@dyw)<br />
i.e UDFDays(04,2009,&#8217;Sunday&#8217;)<br />
then i should get list as.. </p>
<p>6<br />
13<br />
20<br />
27</p>
<p>i.e&#8230; the dates from the month given for weekday..  like for Apil 2009 Saturday..<br />
i expect..esult as </p>
<p>5<br />
12<br />
19<br />
26</p>
<p>etc&#8230;<br />
thanks in advance&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - 2008 - Interview Questions and Answers - Part 2 Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-47465</link>
		<dc:creator><![CDATA[SQL SERVER - 2008 - Interview Questions and Answers - Part 2 Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Thu, 26 Feb 2009 11:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-47465</guid>
		<description><![CDATA[[...] A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a TSQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored procedure which can also return record sets. (Read Here For Example) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a TSQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored procedure which can also return record sets. (Read Here For Example) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-47247</link>
		<dc:creator><![CDATA[SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Tue, 24 Feb 2009 12:10:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-47247</guid>
		<description><![CDATA[[...] SQL SERVER - UDF - User Defined Function - Get Number of Days in Month [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER &#8211; UDF &#8211; User Defined Function &#8211; Get Number of Days in Month [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maheswaran</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-46057</link>
		<dc:creator><![CDATA[Maheswaran]]></dc:creator>
		<pubDate>Wed, 28 Jan 2009 10:23:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-46057</guid>
		<description><![CDATA[I want No.of days in a Month - Here i will give Month(2) and Year(2009),

so, there are two parameters.

Pls Give me the function]]></description>
		<content:encoded><![CDATA[<p>I want No.of days in a Month &#8211; Here i will give Month(2) and Year(2009),</p>
<p>so, there are two parameters.</p>
<p>Pls Give me the function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mahesh K Rajan</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-43671</link>
		<dc:creator><![CDATA[Mahesh K Rajan]]></dc:creator>
		<pubDate>Mon, 13 Oct 2008 08:39:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-43671</guid>
		<description><![CDATA[We have already some built in functions avail, then why should we go behind all those steps...
Anyway, good logic... 
-Mahesh]]></description>
		<content:encoded><![CDATA[<p>We have already some built in functions avail, then why should we go behind all those steps&#8230;<br />
Anyway, good logic&#8230;<br />
-Mahesh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: poleswar</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-40563</link>
		<dc:creator><![CDATA[poleswar]]></dc:creator>
		<pubDate>Mon, 21 Jul 2008 12:23:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-40563</guid>
		<description><![CDATA[EXCELLENT ...:))

EXACTLY SUITS MY REQUIREMENT

SUPERB 

THNX A LOT.........]]></description>
		<content:encoded><![CDATA[<p>EXCELLENT &#8230;:))</p>
<p>EXACTLY SUITS MY REQUIREMENT</p>
<p>SUPERB </p>
<p>THNX A LOT&#8230;&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishwanath</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-34207</link>
		<dc:creator><![CDATA[Vishwanath]]></dc:creator>
		<pubDate>Mon, 10 Mar 2008 09:51:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-34207</guid>
		<description><![CDATA[Just a modification to Doug&#039;s posting : 

CREATE FUNCTION [dbo].[ufn_GetDaysInMonth] (@CurrentDate DATETIME )
RETURNS INT
AS
BEGIN
DECLARE @RetDate INT
SET @RetDate = DAY(DATEADD(d, -DAY(DATEADD(m,1,@CurrentDate)),DATEADD(m,1,@CurrentDate)))
RETURN @RetDate
END


-- SELECT [dbo].[ufn_GetDaysInMonth] (&#039;2008/02/25&#039;)]]></description>
		<content:encoded><![CDATA[<p>Just a modification to Doug&#8217;s posting : </p>
<p>CREATE FUNCTION [dbo].[ufn_GetDaysInMonth] (@CurrentDate DATETIME )<br />
RETURNS INT<br />
AS<br />
BEGIN<br />
DECLARE @RetDate INT<br />
SET @RetDate = DAY(DATEADD(d, -DAY(DATEADD(m,1,@CurrentDate)),DATEADD(m,1,@CurrentDate)))<br />
RETURN @RetDate<br />
END</p>
<p>&#8211; SELECT [dbo].[ufn_GetDaysInMonth] (&#8217;2008/02/25&#8242;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thiru</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-15182</link>
		<dc:creator><![CDATA[Thiru]]></dc:creator>
		<pubDate>Fri, 12 Oct 2007 03:04:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-15182</guid>
		<description><![CDATA[Hi pinaldave, 

Thank you very much]]></description>
		<content:encoded><![CDATA[<p>Hi pinaldave, </p>
<p>Thank you very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-13400</link>
		<dc:creator><![CDATA[Doug]]></dc:creator>
		<pubDate>Thu, 20 Sep 2007 15:37:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-13400</guid>
		<description><![CDATA[Try this one-liner:
CREATE FUNCTION [dbo].[ufn_GetDaysInMonth](
@CurrentDate DATETIME )
RETURNS INT
AS
BEGIN
RETURN DAY(DATEADD(d, -DAY(DATEADD(m,1,@dt)),DATEADD(m,1,@dt))) 
END]]></description>
		<content:encoded><![CDATA[<p>Try this one-liner:<br />
CREATE FUNCTION [dbo].[ufn_GetDaysInMonth](<br />
@CurrentDate DATETIME )<br />
RETURNS INT<br />
AS<br />
BEGIN<br />
RETURN DAY(DATEADD(d, -DAY(DATEADD(m,1,@dt)),DATEADD(m,1,@dt)))<br />
END</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Munna Sarfraz Ahmad</title>
		<link>http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-12931</link>
		<dc:creator><![CDATA[Munna Sarfraz Ahmad]]></dc:creator>
		<pubDate>Mon, 17 Sep 2007 10:49:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/#comment-12931</guid>
		<description><![CDATA[Hi This User defined function will return the no. of days in a month

CREATE FUNCTION [dbo].[ufn_GetDaysInMonth](
	 	@CurrentDate DATETIME )
		RETURNS INT
	AS
	BEGIN
	DECLARE @ReturnDays INT
		SET @ReturnDays =
				CASE 	WHEN MONTH(@CurrentDate) IN (1, 3, 5, 7, 8, 10, 12) THEN 31
					WHEN MONTH(@CurrentDate) IN (4, 6, 9, 11) THEN 30
						ELSE 
							CASE WHEN (YEAR(@CurrentDate) % 4 = 0 AND YEAR(@CurrentDate) % 100 != 0) OR (YEAR(@CurrentDate) % 400 = 0)	THEN 29
								ELSE 28 
							END
				END
		RETURN @ReturnDays
	END

--SELECT dbo.ufn_GetDaysInMonth(GETDATE()) No_Of_Days_In_Month
GO]]></description>
		<content:encoded><![CDATA[<p>Hi This User defined function will return the no. of days in a month</p>
<p>CREATE FUNCTION [dbo].[ufn_GetDaysInMonth](<br />
	 	@CurrentDate DATETIME )<br />
		RETURNS INT<br />
	AS<br />
	BEGIN<br />
	DECLARE @ReturnDays INT<br />
		SET @ReturnDays =<br />
				CASE 	WHEN MONTH(@CurrentDate) IN (1, 3, 5, 7, 8, 10, 12) THEN 31<br />
					WHEN MONTH(@CurrentDate) IN (4, 6, 9, 11) THEN 30<br />
						ELSE<br />
							CASE WHEN (YEAR(@CurrentDate) % 4 = 0 AND YEAR(@CurrentDate) % 100 != 0) OR (YEAR(@CurrentDate) % 400 = 0)	THEN 29<br />
								ELSE 28<br />
							END<br />
				END<br />
		RETURN @ReturnDays<br />
	END</p>
<p>&#8211;SELECT dbo.ufn_GetDaysInMonth(GETDATE()) No_Of_Days_In_Month<br />
GO</p>
]]></content:encoded>
	</item>
</channel>
</rss>

