Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to get the days in month using query

Author  Topic 

pentahari
Starting Member

26 Posts

Posted - 2008-09-05 : 01:48:04
how to get the days in month using query

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-09-05 : 01:53:05
Did you try google to find answer to your query. Read this entry.

http://weblogs.sqlteam.com/jeffs/archive/2008/01/17/60458.aspx

and to answer your query search google for "days in month sql server". you will find many answers
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-07 : 00:12:51
SELECT * FROM YourTable WHERE datefield > DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)
AND datefield < DATEADD(mm,DATEDIFF(mm,0,GETDATE())+1,0)
Go to Top of Page
   

- Advertisement -