SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 DATE FUNCTION ONLY FOR CURRENT MONTH
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Blessed1978
Yak Posting Veteran

65 Posts

Posted - 08/26/2014 :  14:35:40  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3712 Posts

Posted - 08/26/2014 :  15:12:31  Show Profile  Reply with Quote
WHERE
	yourDateCol >= DATEADD(mm,DATEDIFF(mm,0,GETDATE()),0) 
	AND yourDateCol < GETDATE()
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000