Forum Discussion
SQL 2025 Jobs
SQL Server 2022 16.0.4212.1 Installed in a windows server 2025 DC.
SQLSERVERAGENT starts with NT Service\SQLSERVERAGENT
I have some jobs that runs at the scheduled times.
But one no.
Failure: "Job failed. The job was invoked by Schedule 9 (06:00 xxxxx). The last step to execute was step 0 (no steps ran)."
Job steps: exec SP_01
GO
EXEC SP_02
But if I run it manually, it runs without problems. Can anyone help me?
Thank you
4 Replies
- do2023335Copper Contributor
Hello
Many tests performed.
I created two independent tasks do type (T-SQL) , each calling one of the two Store procedures. They failed.
I executed then the Store procedures directly and saved each generated SQLquery in two SQL files.
I created two tasks, each with a step of the type (operating system - (cmdexec) and with the command = sqlcmd -S XXXXX -i ".......................file.sql") --- It works.
I ran lab on another machine, running Windows 11 Pro and also with SQL 2022 Standard.
I created the database in question and restored it from a recent backup.
Everything worked exactly as described above, even when I set a Windows account to start the agent service.
This database was on a server running SQL Standard 2017 and Windows Server 2012. Now it's on SQL 2022 Standard running on Windows Server 2025vStd.
I'm clueless!
- do2023335Copper Contributor
Hello
Hello
Many tests performed.
I created two independent tasks do type (T-SQL) , each calling one of the two Store procedures. They failed.
I executed then the Store procedures directly and saved each generated SQLquery in two SQL files.
I created two tasks, each with a step of the type (operating system - (cmdexec) and with the command = sqlcmd -S XXXXX -i ".......................file.sql") --- It works.
I ran lab on another machine, running Windows 11 Pro and also with SQL 2022 Standard.
I created the database in question and restored it from a recent backup.
Everything worked exactly as described above, even when I set a Windows account to start the agent service.
This database was on a server running SQL Standard 2017 and Windows Server 2012. Now it's on SQL 2022 Standard running on Windows Server 2025vStd.
I'm clueless!
- do2023335Copper Contributor
Hello
This job as only one step
I'll run some tests this weekend. I'll share something on Monday.
Thanks anyway
- SivertSolemIron Contributor
Go to the Steps section of your job, and verify that the correct step is selected as the start step.
Note that the first step is step 1, not 0.
Shown here with the default syspolicy_purge_history job.
When you start jobs manually, you also manually select the step to start it on (Start job on step), which explains how you wouldn't see this failure mode when manually starting your job.