Schedule DTS Package Reports Success but Fails

  • Can you setup and run this job:

    BEGIN TRANSACTION

    DECLARE @JobID BINARY(16)

    DECLARE @ReturnCode INT

    SELECT @ReturnCode = 0

    IF (SELECT COUNT(*) FROM msdb.dbo.syscategories WHERE name = N'[Uncategorized (Local)]') < 1

    EXECUTE msdb.dbo.sp_add_category @name = N'[Uncategorized (Local)]'

    -- Delete the job with the same name (if it exists)

    SELECT @JobID = job_id

    FROM msdb.dbo.sysjobs

    WHERE (name = N'Test Command')

    IF (@JobID IS NOT NULL)

    BEGIN

    -- Check if the job is a multi-server job

    IF (EXISTS (SELECT *

    FROM msdb.dbo.sysjobservers

    WHERE (job_id = @JobID) AND (server_id <> 0)))

    BEGIN

    -- There is, so abort the script

    RAISERROR (N'Unable to import job ''Test Command'' since there is already a multi-server job with this name.', 16, 1)

    GOTO QuitWithRollback

    END

    ELSE

    -- Delete the [local] job

    EXECUTE msdb.dbo.sp_delete_job @job_name = N'Test Command'

    SELECT @JobID = NULL

    END

    BEGIN

    -- Add the job

    EXECUTE @ReturnCode = msdb.dbo.sp_add_job @job_id = @JobID OUTPUT , @job_name = N'Test Command', @owner_login_name = N'sa', @description = N'No description available.', @category_name = N'[Uncategorized (Local)]', @enabled = 1, @notify_level_email = 0, @notify_level_page = 0, @notify_level_netsend = 0, @notify_level_eventlog = 2, @delete_level= 0

    IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

    -- Add the job steps

    EXECUTE @ReturnCode = msdb.dbo.sp_add_jobstep @job_id = @JobID, @step_id = 1, @step_name = N'Dir', @command = N'dir c: > c:\TestJob.txt', @database_name = N'', @server = N'', @database_user_name = N'', @subsystem = N'CmdExec', @cmdexec_success_code = 0, @flags = 0, @retry_attempts = 0, @retry_interval = 1, @output_file_name = N'', @on_success_step_id = 0, @on_success_action = 1, @on_fail_step_id = 0, @on_fail_action = 2

    IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

    EXECUTE @ReturnCode = msdb.dbo.sp_update_job @job_id = @JobID, @start_step_id = 1

    IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

    -- Add the Target Servers

    EXECUTE @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @JobID, @server_name = N'(local)'

    IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback

    END

    COMMIT TRANSACTION

    GOTO EndSave

    QuitWithRollback:

    IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION

    EndSave:

    It just runs a dir c: to a text file.

    Steve Jones

    steve@dkranch.net

  • Is this an Active X Script?

    Jeff Matthews


    Jeff Matthews

  • O.K. I created a package and ran it from a scheduled job. Then I looked in the c:\ dir for c:\TestJob.txt. I couldn't find that text file. The job reported the same as the other ones; "The step did not generate any output. Process Exit Code 0. The step succeeded." I then took that code and ran it from the query analyzer and I still didn't find were the text file was created, but it reports that it executed successfully.

    Jeff Matthews


    Jeff Matthews

  • It should have created a text file on the c: drive of the server in the root called testjob.txt. It will not be on your local c: drive, so be sure you are examining the server.

    If you execute it from Query Analyzer, you would run

    xp_cmdshell 'dir c: > c:\testjob.txt'

    If this does not work, I think your upgrade failed somewhere.

    Steve Jones

    steve@dkranch.net

  • I made sure to check the server's local drive and my local drive (just in case), but I didn't find the testjob.txt.

    O.K. basically you don't know of any problems with upgrading the client only tools to 2000 on a 7.0 server. So I could reninstall that and hopefully it would fix any corrupted files or bad installation. If not then I guess I will need to reinstall 7.0.

    Thanks to everyone for their assistants!

    Jeff

    Jeff Matthews


    Jeff Matthews

  • Sorry we couldn't help. Haven't seen this, but if you get in a bind, might be worth calling MS. It's $250, but how soon could you burn $250 of your time?

    Steve Jones

    steve@dkranch.net

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply