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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-08-30 : 08:00:01
|
| nani writes "how to get first day in a month when entered any day in that month using sql server?" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-30 : 08:18:38
|
| Select dateadd(d,1,getdate()- day(getdate())) MadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-08-30 : 09:19:05
|
| Mady's solution will get you the 1st day of the month, with the current time.If you want midnight this may do what you want:SELECT DateAdd(Month, DateDiff(Month, 0, getdate()), 0)Kristen |
 |
|
|
yoko
Starting Member
3 Posts |
Posted - 2005-08-30 : 11:29:11
|
| How can I get the Current Month and year with this formula ie August, 2005?thanks |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-08-30 : 11:57:30
|
| Sorry not sure what you are after;Given that "now" is 16:54 on 30th August, 2005 do you want:01 August 2005 16:5401 August 2005 00:00or "August 2005"??Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-31 : 01:38:55
|
quote: Originally posted by yoko How can I get the Current Month and year with this formula ie August, 2005?thanks
select datename(month, Getdate()) + ', ' + datename(year, Getdate())MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|