Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006

    Unanswered: How to create and schedule a job using linked servers?

    There are 2 sql servers : A and C.
    I have to grab data on server A and update records with this data on server C. It has to run every night, so it has to be scheduled as a job.
    I created linked server on server A and ran query select... It works.
    I can create Update query.
    What are my steps next? I read how to create a job, but not understand how to incorporate the query into it. I am totaly unexpirenced user, please explain step by step or give me a link to a good explanation. I also do not understand how and whether DTS should be used in all this.
    Appreciate any help.


  2. #2
    Join Date
    Jun 2003

    Thumbs up

    wrap ur sql query in SP,create and call that SP from job steps.
    From BOL,
    How to create a job (Enterprise Manager)

    To create a job
    1. Expand a server group, and then expand a server.
    2. Expand Management, and then expand SQL Server Agent.
    3. Right-click Jobs, and then click New Job.
    4. In the Name box, enter a name for the job.

    To create a Transact-SQL job step
    1. Create a new job or right-click an existing job, and then click Properties. For more information on creating a job, see Creating Jobs.
    2. In the Job Properties dialog box, click the Steps tab, and then click New.
    3. In the Step name box, enter a job step name.
    4. In the Type list, click Transact-SQL Script (TSQL).
    5. In the Database list, click a database for this job step to use.
    6. In the Command box, enter the Transact-SQL command batch(es), or click Open to select a Transact-SQL file to use as the command.
    7. Click Parse to check your syntax. The message "Parse succeeded" is displayed when your syntax is correct. If an error is found, correct the syntax before continuing.
    I love cursor,though I never use it.Cos' I dont want to misuse it.


  3. #3
    Join Date
    Mar 2006
    I created a stored procedure for the job and not sure what Type and Command do I use in this case? EXEC MyProcedure in command window eith type TSQL does not work. The procedur is working fine when I run this command in Query Analyser:EXEC MyProcedure .

    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts