SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Job Step Properties of SQL Server Agent job in SSMS does not match generated TSQL code


Job Step Properties of SQL Server Agent job in SSMS does not match generated TSQL code

Author
Message
thomas.horner
thomas.horner
SSC-Enthusiastic
SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)

Group: General Forum Members
Points: 130 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?
DonFerguson
DonFerguson
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 316
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.



thomas.horner
thomas.horner
SSC-Enthusiastic
SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)

Group: General Forum Members
Points: 130 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).
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search