Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I need to write SQL code to get first day date of the three months back. ie when i run the SQL code today (ie Aug 02 2006), the code should display 05/01/2006 ( ie May 01 2006).Can anybody help me on this?
TG
Master Smack Fu Yak Hacker
6065 Posts
Posted - 2006-08-02 : 14:56:34
Try this:select dateadd(month, datediff(month, 0, dateadd(month,-3,getdate())), 0)Be One with the OptimizerTG