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 |
|
nt86
Yak Posting Veteran
54 Posts |
Posted - 2010-01-05 : 09:58:59
|
| Im using a stored Procedure and I want to retrieve all the records which were added in the last 7 days. So basically from the day that the report is run it should take into consideration the last 7 days. When a record is added the days date is recorded in the record as startup_Time, so i can use this. I've tried this code but it does not work, its not showing an error its just not returning anythingSELECT * FROM #savingstemp WHERE startup_Time >=dateadd(day,datediff(day,0,GetDate())- 7,0)There is a similar thread on the forum but the code which worked for this person doesn't seem to work for me, i know he was using SQL 2000 but i thought the code would be similar.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=101490Thanks in advance :)niall |
|
|
nt86
Yak Posting Veteran
54 Posts |
Posted - 2010-01-05 : 10:02:03
|
| I solved it very stupid mistake, the code actually works perfectly :)niall |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-01-05 : 10:03:58
|
| What error is it throwing...and what is the datatype of your field startup_Time? |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-01-05 : 10:06:00
|
| Ohh ok..Never mind. I replied after seeing your OP and dint realize you had solved it by then. |
 |
|
|
nt86
Yak Posting Veteran
54 Posts |
Posted - 2010-01-05 : 10:08:46
|
quote: Originally posted by vijayisonly Ohh ok..Never mind. I replied after seeing your OP and dint realize you had solved it by then.
Thanks anywayniall |
 |
|
|
|
|
|