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 |
|
a_shipra
Starting Member
20 Posts |
Posted - 2004-07-29 : 23:59:47
|
| Hi all,I need some help with this.Can you tell me in the select statement what is happening?Declare @lastDate int SELECT @lastdate = DAY(DATEADD(DAY,-1,DATEADD(MONTH,1,DATEADD(DAY,1-DAY(@when),@when)))) Thanksshipra |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2004-07-30 : 00:21:09
|
| Looks like it's calculating the end of the month (where the date is @when)The inner-most one DATEADD(DAY,1-DAY(@when),@when)) gets the first day of the current month The next one out gets the first day of the next month, and the outer-most one gets the previous day. |
 |
|
|
a_shipra
Starting Member
20 Posts |
Posted - 2004-07-30 : 00:27:11
|
| Thanks for your help |
 |
|
|
|
|
|