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
 Other Forums
 Other Topics
 Automating an SQL query?

Author  Topic 

tom bombadil
Starting Member

3 Posts

Posted - 2008-09-19 : 08:22:36
Hi There I have the following query:



select count(*) from database.table t where
t.SSC_CREATEDDATE > TO_DATE('07/07/2008 08:00:00', 'dd/mm/yyyy HH:MI:SS') and
t.SSC_CREATEDDATE < TO_DATE('07/07/2008 09:00:00', 'dd/mm/yyyy HH:MI:SS')



Problem is i need to run this query every subsequent hour for 1 month and then pull this information into an excel document. Can anyone provide me with any assistance please or pointers at where to start?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-09-19 : 09:30:28
use a scheduled job you lord of the rings lover

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

tom bombadil
Starting Member

3 Posts

Posted - 2008-09-19 : 09:40:39
Ahhhh Lord of the Rings(the book of course!)

Can the scheduled job increment the hour timeframe? It isnt my intention to run the identical query every hour. I actually need to move the timeframe 1 hour forward to count, all orders say, during every hour of the month. Maybe I am not explaining clearly :-(

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-09-19 : 09:47:43
well i guess you should take a look at the scheduling capabilities of the scheduled jobs in sql server.
there you'll see if it's possible to do what you need. if it's not then you'll have to create a solution by yourself.


i don't think there was the Tom in the movie, was there?


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

tom bombadil
Starting Member

3 Posts

Posted - 2008-09-19 : 09:57:14
Nope there wasn't unfortunately. Some of the nicest scenes in the book were with good old Tom!

Thanks for the information regarding the scheduler, I will look at it closely now. Thanks!
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-19 : 10:09:18
I think TO_Date is related to ORACLE.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-09-19 : 10:39:54
Didn't they cut tom bombadil out of the movie ? (I don't remember him being there)

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-09-19 : 10:47:13
he wasn't in the movie.


elsasoft.org
Go to Top of Page
   

- Advertisement -