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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Declaring the 1st of the month

Author  Topic 

sunnyday126
Starting Member

5 Posts

Posted - 2007-03-08 : 19:14:32
How do I declare the beginning of the month? (3/1/07) By running this, I get 3/7/2007. Thanks!

declare @paramtoday datetime
declare @parammoend1 datetime

Set @parammoend1 = DateAdd(d,1, @paramtoday)

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-08 : 20:42:25
[code]select dateadd(month, datediff(month, 0, getdate()), 0)[/code]


KH

Go to Top of Page

sunnyday126
Starting Member

5 Posts

Posted - 2007-03-09 : 13:49:37
Nice!! Thank you!!
Go to Top of Page
   

- Advertisement -