Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    Arizona
    Posts
    75

    Unanswered: Scheduling a Stored Proc

    I have a scheduled T-SQL event that should run a stored procedure. Here is the code:

    USE [OFMtest]
    GO
    DECLARE @return_value int
    EXEC @return_value = [dbo].[ImportFromOFMLink]
    SELECT 'Return Value' = @return_value
    GO

    Should I take the GOs out?


    When I run it it comes back with the following error...

    NEW COMPONENT OUTPUT
    Microsoft(R) Server Maintenance Utility (Unicode) Version 9.0.3042
    Report was generated on "SVR020".
    Maintenance Plan: SyncOFMLink_to_OFMTest
    Duration: 00:00:00
    Status: Warning: One or more tasks failed..
    Details:
    Execute T-SQL Statement Task (SVR020)
    Execute TSQL on Local server connection
    Execution time out: 0
    Task start: 2011-09-22T16:44:18.
    Task end: 2011-09-22T16:44:18.
    Failed-1073548784) Executing the query "

    " failed with the following error: "Could not find stored procedure 'dbo.ImportFromOFMLink'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

    I noticed that the is an object inspector when using MS-SQL Server Management Studio but I can not figure out how to get this to connect to the right database. I thought that by using the

    USE [OFMtest]

    Would specify the database to find the stored proc under but it failed.

    I guess I could just copy the SQL into the T-SQL instead of running it as a stored proc but I like it to be in a stored proc so that I can make modifications without having to remember to go to the scheduled T-SQL event and updating it too.

    Any suggestion?

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Did you try:
    Code:
    DECLARE @return_value int
    EXEC @return_value = [OFMtest].[dbo].[ImportFromOFMLink]
    SELECT 'Return Value' = @return_value
    GO
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Apr 2004
    Location
    Arizona
    Posts
    75
    Thanks, that worked.

  4. #4
    Join Date
    Sep 2011
    Posts
    75

Posting Permissions

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