Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    139

    Unanswered: rundts from within a stored procedure

    I saved a dts package as a structured storage file and put it in a directory.

    I'm trying to call and run it with the following stored procedure-

    CREATE PROCEDURE run_dts AS

    DECLARE @object int
    DECLARE @hr int

    --create a package object
    EXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUT
    if @hr <> 0
    BEGIN
    print 'error create DTS.Package'
    RETURN
    END

    EXEC @hr = sp_OAMethod @object, 'LoadFromStorageFile',
    NULL, '\\server\directory\billing.dts', ''
    IF @hr <> 0
    BEGIN
    print 'error LoadFromStorageFile'
    RETURN
    END

    EXEC @hr = sp_OAMethod @object, 'Execute'
    IF @hr <> 0
    BEGIN
    print 'Execute failed'
    RETURN
    END
    GO

    If I run this from query analyzer, it gives me "The command(s) completed successfully," but the dts doesn't run?

    Any ideas?
    Thanks,
    Bill

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    try checking the permission context\owner of the the stored procedure vs. that of the DTS package.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

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