Solved

SQL server 2005 Create Scheduled Job

Posted on 2011-02-20
6
446 Views
Last Modified: 2012-05-11
In SQL server 2005, I have two queries that I need to run as scheduled job with daily refresh.

These are the queries:

DELETE OPENQUERY ([MYLinkedServer], 'select * from Target_tab');

INSERT INTO OPENQUERY([MYLinkedServer], 'select fid, FName from Target_tab')
select TNumber, FName from dbo.Source_tab;

The above queries run well on the SQL server 2005. The target is an Oracle database.

How do I create a scheduled job for these two queries on the SQL server?
0
Comment
Question by:toooki
  • 3
  • 3
6 Comments
 
LVL 6

Accepted Solution

by:
AkAlan earned 450 total points
ID: 34938881
SQL Server Agent
Right Click on Jobs and select New Job.
0
 

Author Comment

by:toooki
ID: 34939183
Thank you. I created (tried to create) this procedure:

I get error when I run the CREATE PROCEDURE command:

Msg 262, Level 14, State 1, Procedure MyProc1, Line 14
CREATE PROCEDURE permission denied in database 'myDbname'.

What privileges are needed to create  PROCEDURE and create job?

Where do I find SQL server Agent? (I do not see under Programmability or Security tab)
USE [myDbname]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[MyProc1] 
AS

BEGIN

SET NOCOUNT ON;
DELETE OPENQUERY ([MYLinkedServer], 'select * from Target_tab')

INSERT INTO OPENQUERY([MYLinkedServer], 'select fid, FName from Target_tab')
select TNumber, FName from dbo.Source_tab


END
END

Open in new window

0
 
LVL 6

Expert Comment

by:AkAlan
ID: 34939214
SQL Server Agent is part of SQL Management Studio. If you don't see it you need to do some research on how to install it. It is what allows you to create scheduled jobs, backups, view event logs and so forth. If you aren't an administrator on the sql server then you need that person to give you permissions to create stored procedures. If you are an administrator but are logged in with a non admin account, you need to give that account permissions.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:toooki
ID: 34939264
Thank you. I am not the administrator of the database. I only have one login to use in that SQL server. And I am using SQL server management studio express.

I will ask the administrator to give me:
1. permissions to create stored procedures.

Do I need any other permission to create scheduled job?
I attached the screen-shot of the SQL server management studio (everything that shows under the database name). Was the the "SQL Server Agent" part supposed to show up here? sql server management studio screen
0
 
LVL 6

Expert Comment

by:AkAlan
ID: 34939295
I think you will have to also get permissions to create jobs. Here is a screen shot of what sql agent will look like if you had it.
SqlServerImage.docx
0
 

Author Comment

by:toooki
ID: 34990076
I found it later. I was using SQL server management studio "Express". The free one does not have the Agent. The licensed one has...
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now