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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 DATE FUNCTION ONLY FOR CURRENT MONTH

Author  Topic 

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-08-26 : 14:35:40
Date function that gets dates within current month only
so if i run a report ON AUGUST 10, It should only get dates between August 1 - 10 . AUGUST 28 should get dates between August 1 - 28 etc

how do i accomplish this

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-08-26 : 15:12:31
[code]WHERE
yourDateCol >= DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0)
AND yourDateCol < GETDATE()
[/code]
Go to Top of Page
   

- Advertisement -