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 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-07-23 : 10:18:11
Dear All,

How can i get first date of month.

Please help

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-23 : 10:21:16

select dateadd(month,datediff(month,0,getdate()),0)

Madhivanan

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

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-07-23 : 13:23:19
SELECT DATEADD(MONTH, 12 * @Year - 22801 + @Month, 0)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-07-24 : 02:47:33
it depends you are passing month as what datatype whether you are giving month number of month name

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-26 : 08:39:29
or

select dateadd(year,@year-1900,dateadd(month,@month-1,0))


Madhivanan

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

- Advertisement -