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
 First Date Of The Month

Author  Topic 

apantig
Posting Yak Master

104 Posts

Posted - 2005-11-23 : 00:09:47
Hi guys,

How to get the first day of the month.

Say the given Cut Off Date is 11/30/2005. I need to get the StartDate as 11/01/2005.

Thank you.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-23 : 00:24:57
Select DateAdd(Month,DateDiff(Month,0,'11/30/2005'),0)


Madhivanan

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

nr
SQLTeam MVY

12543 Posts

Posted - 2005-11-23 : 09:13:56
or
convert(varchar(6),@dte,112) + '01'


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -