Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(JOBNAME) variable not working on SQL Server 2014? #801

Closed
tivivi63 opened this issue Apr 12, 2024 · 2 comments
Closed

(JOBNAME) variable not working on SQL Server 2014? #801

tivivi63 opened this issue Apr 12, 2024 · 2 comments

Comments

@tivivi63
Copy link

Hello,

Getting following message when executing whichever Ola's job using JOBNAME variable in Advanced>Output file parameter, like $(ESCAPE_SQUOTE(SQLLOGDIR))\$(ESCAPE_SQUOTE(JOBNAME))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(DATE))_$(ESCAPE_SQUOTE(TIME)).txt) in CommandLog Cleanup job.

Message
Unable to start execution of step 1 (reason: Variable JOBNAME not found).  The step failed.

Both are executed on mly laptop (though outputs differ regarding OS version 😕) but I do have the same behaviour on virtualized servers (e.g Windows Server 2016). Really looks like related to SQL version, not Windows Server build.

Fails:

Microsoft SQL Server 2014 (SP3-CU4-GDR) (KB5014164) - 12.0.6439.10 (X64)   Apr 20 2022 03:13:42   Copyright (c) Microsoft Corporation  Developer Edition (64-bit) on Windows NT 6.3 <X64> (Build 19045: ) (Hypervisor)

Works:

Microsoft SQL Server 2019 (RTM-CU20) (KB5024276) - 15.0.4312.2 (X64)   Apr  1 2023 12:10:46   Copyright (C) 2019 Microsoft Corporation  Developer Edition (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 19045: ) (Hypervisor) 

Version of the script
Version: 2022-12-03 17:23:44

Thanks for sharing this tremendous tool 🙏

@Stiffboard
Copy link

Installing scripts take care of that I believe... One of the variables, SQLLOGDIR I think, is not available in older versions. So if you script the job from a newer it won't work.

@tivivi63
Copy link
Author

https://learn.microsoft.com/en-us/sql/ssms/agent/use-tokens-in-job-steps?view=sql-server-ver16#sql-server-agent-tokens

As stated in the documentation, both JOBNAME and STEPNAME tokens are not availlable until SQL Server 2016 😕

(JOBNAME) | The name of the job. This token is only available on SQL Server 2016 and above.
(STEPNAME) | The name of the step. This token is only available on SQL Server 2016 and above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants