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
 Writing a stored procedure

Author  Topic 

jmersing
Yak Posting Veteran

57 Posts

Posted - 2010-10-07 : 09:18:05

I need to execute 2 SQL statements on an interval of every 6 hours. I'm told it can be done in a stored procedure but have no idea how to do it.


Could someone point me in the right direction, do I need to provide any other patameters?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-07 : 10:21:35
you should use a sql agent job for this.
Go to Top of Page

jmersing
Yak Posting Veteran

57 Posts

Posted - 2010-10-07 : 11:48:57
I'm not sure what that means, I use queryman to access the database is that something I can do in there?
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-10-07 : 11:56:53
SQL agent is accessible through Management Studio.

Are you sure you are using microsoft sql server?

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

jmersing
Yak Posting Veteran

57 Posts

Posted - 2010-10-07 : 12:53:43
I guess I should get Management Studio - I am using a MS SQL Server.
Go to Top of Page

jmersing
Yak Posting Veteran

57 Posts

Posted - 2010-10-07 : 13:15:32
Any further advice on how to build this procedure without Management studio?
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-07 : 13:31:31
Building the proc is nothing more than putting CREATE PROCEDURE above your SQL statement and compiling it (executing the create proc stmt).

The problem is scheduling it. SQL Agent job is best for this.

Can use sp_Add_job, sp_add_jobstep, sp_add_schedule if you don;t have Management Studio...

See here: http://msdn.microsoft.com/en-us/library/ms182079.aspx
Go to Top of Page
   

- Advertisement -