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 |
|
AlexP
Starting Member
34 Posts |
Posted - 2005-08-02 : 16:36:46
|
| Can anyone help me get the dates for the previous week's Monday 12:00:00am thru Sunday 11:59:59PM?Thanks |
|
|
thekeane
Starting Member
7 Posts |
Posted - 2005-08-02 : 17:00:20
|
| Use DATEADD ( datepart , number, date ) Figure out what today is and then create a variable which will contain a negative number that will bring you back to Sunday, i.e. if monday then -1 etc.Then create a variable for each day that you are looking for have negative offsets 1-7. Then add the number that you found above. Should then be able to use DateAdd again to find all 7 dates.Might be an easier way, but this is what came to mind. |
 |
|
|
|
|
|