Introduction:
Description:
In previous articles I explained Insert values in identity column in SQL Server, Check if string contains specific word in SQL, SQL Query to read xml file, SQL Query to get duplicate records count, SQL Query to get month wise, year wise data and many articles relating to SQL Server, jQuery, JavaScript. Now I will explain how to get or find total number of days in month using SQL Server.
In previous articles I explained Insert values in identity column in SQL Server, Check if string contains specific word in SQL, SQL Query to read xml file, SQL Query to get duplicate records count, SQL Query to get month wise, year wise data and many articles relating to SQL Server, jQuery, JavaScript. Now I will explain how to get or find total number of days in month using SQL Server.
To
get total number of days in a month we need to write the query like as shown
below
DECLARE @sample datetime
SET @sample=GETDATE() -- Sample date
select datediff(dd,dateadd(dd, 1-day(@sample),@sample), dateadd(m,1,dateadd(dd, 1-day(@sample),@sample)))
|
No comments :
Post a Comment