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 - 2004-04-30 : 14:01:11
|
| Barry Miller writes "I have a basic call logging application which runs on SQL Server 200 and Windows 2000 storing the date and Time of every call logged as a single field. I am trying to write a query that will display the data from the previous week (Sunday to Staurday) and not having much luck. The current report simply reports -x days from today and not the whole of the previous weekHope you can helpBarry" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-04-30 : 14:24:06
|
| First you need the previous Saturdaydeclare @d datetimeselect @d = dateadd(dd,datepart(dw,getdate())*-1,getdate())select @d = convert(varchar(8),@d,112)nowwhere dte >= dateadd(dd,-7,@d) and dte < dateadd(dd,1,@d)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|