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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 run a sproc every week

Author  Topic 

Arianne Quitilen
Starting Member

1 Post

Posted - 2009-09-15 : 09:16:36
i'm using sql server 2005. my stored proc runs daily but i want to run my sproc every end of the week that will get all the 7 days data from our db..


thanks in advance!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-09-15 : 09:20:16
schedule it in SQL Agent to run once a week

and in your query

WHERE somedatecol >= dateadd(day, datediff(day, 0, getdate()), -7)
AND somedatecol < dateadd(day, datediff(day, 0, getdate()), 0)



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -