Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Job Step Properties of SQL Server Agent job in SSMS does not match generated TSQL code Expand / Collapse
Author
Message
Posted Wednesday, December 5, 2012 1:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 31, 2013 2:01 PM
Points: 8, Visits: 33
The Job Step Properties of SQL Server Agent job in SSMS does not match generated TSQL code
when I select "Script Job as create to new query window" for the same Agent job.

In the job I am looking at, the job step properties screens do NOT show a database name, just the TSQL command
being run. However, when I look at the TSQL generated by the "Script Job as create..." for these job steps,
the sp_add_jobstep command options DO show a database_name. For example:

EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'Datawhs Update Stats',
@step_id=2,
@cmdexec_success_code=0,
@on_success_action=3,
@on_success_step_id=0,
@on_fail_action=2,
@on_fail_step_id=0,
@retry_attempts=0,
@retry_interval=0,
@os_run_priority=0, @subsystem=N'TSQL',
@command=N'sp_updatestats',
@database_name=N'Datawhs',
@flags=0

However, when I look at the Job Step Properties of this step in the Agent job, the "Database:" entry
is not filled in, only the "Command:" entry (in this case sp_updatestats). How can the job step properties
have a blank database name and yet the sp_add_jobstep entry have it filled in?

Post #1393189
Posted Tuesday, January 15, 2013 12:26 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, August 11, 2014 6:15 PM
Points: 2, Visits: 206
I had the same issue. Please check and make sure that the database name specified in the job step matches the database name specified in the SQL Server instance (CASE SENSITIVE). It seems that if the database name with case sensitivity does not exactly match the name on the server it will show a blank. This appears to have been corrected in SSMS 2012.


Post #1407422
Posted Tuesday, January 15, 2013 1:03 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 31, 2013 2:01 PM
Points: 8, Visits: 33
Thank you! It was indeed the "case" of the database name in the job step versus the name in the instance. If the database name's case matched the name in the instance, it showed. If not, it did not show. This job is on four servers, and one had the name of the database in the same case, and indeed the database showed up in the properties of the job step. The other three it did not (database had different case).
Post #1407446
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse