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 2000 Forums
 SQL Server Development (2000)
 DATEADD function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jim65
Starting Member

35 Posts

Posted - 05/04/2006 :  10:02:29  Show Profile  Reply with Quote
when I used DataAdd function, like DATEADD (mm , @monthCount, @FYE), I have a FYE is '2/28/06'
I can get date '3/28/06', '4/28/06' ........ How can I get '3/31/06. 4/31/06'.....the month end dates. Thanks

madhivanan
Premature Yak Congratulator

India
22744 Posts

Posted - 05/04/2006 :  10:08:40  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote

Select dateadd(month,datediff(month,0,getdate())+1,0)-1 as last_day

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 05/04/2006 :  10:29:08  Show Profile  Reply with Quote
This will find the end of month for any date:

select EOM = dateadd(month,datediff(month,-1,getdate()),-1)

You can also use the F_END_OF_MONTH function on this link:
End Date of Time Period Functions
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64759

CODO ERGO SUM
Go to Top of Page

jim65
Starting Member

35 Posts

Posted - 05/04/2006 :  10:41:57  Show Profile  Reply with Quote
Thanks. you guys.
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