Questions tagged [sql-server-job]

A SQL Server Job is a task that can be executed by the SQL Server Agent

SQL Server allows the creation of individual jobs, repeatable processes which can be run on-demand or via a preset schedule.

Each job consists of one or more job steps, which are executed in sequence. A job step can be one of the following:

  • Executable programs and operating system commands.

  • Transact-SQL statements, including stored procedures and extended stored procedures.

  • PowerShell scripts.

  • Microsoft ActiveX scripts.

  • Replication tasks.

  • Analysis Services tasks.

  • Integration Services packages.

SQL Server jobs are operated through the SQL Server Agent. Frequent uses include database maintenance tasks, ETL package execution, cube processing, and script execution.

55 questions
16
votes
3 answers

How to start SQL Server job from a stored procedure?

How can I create a stored procedure to start a SQL Server job?
g_shockTan
  • 325
  • 2
  • 8
  • 15
10
votes
3 answers

How to increase MaximumErrorCount in SQL Server 2008 Jobs or Packages?

I have several jobs and several packages. In SQL Server 2005 we used to use DTS Packages, but they are now defunct (I know that I can re-enable them, but that's not what I'm after). I receive the following error by running one of my…
Abel
  • 56,041
  • 24
  • 146
  • 247
8
votes
3 answers

How to make a SQL Server agent job step failure on purpose

I have a process and the first step is to check status of other process. If the other process is done I would want to run the rest steps and if not I would want to quit the job. I have a table that looks into the status and if all done it will mark…
Jack
  • 281
  • 1
  • 3
  • 17
4
votes
0 answers

execute sql server agent job task in ssis error : Failed to lock variable"RunIs" for read access with error 0xC0010001

I am using SQL Server 2016 and SSIS. I have a package in which I am calling a sql server job. My job have just one step as PowerShell command for transfering all files from one directory to another directory between two servers. When I run my job…
Ardalan Shahgholi
  • 11,967
  • 21
  • 108
  • 144
4
votes
1 answer

How to catch the exit code of a CMDEXEC SQL Server Job?

The following SQL Server job always exits with return code 0 indicating success, when in fact it does not do its job, i.e. it does not delete "test.txt". How can I catch the actual exit code (something like %ERRORLEVEL%, or a 'permission…
3
votes
1 answer

Special character in Sensitive SSIS Package Parameter String renders package invalid

I have a Sensitive String Parameter on an SSIS Package that is used to store a password for a remote server. However, the Job Agent throws an error whilst configuring the Package Parameters of that step when the string value contains a curly…
wp78de
  • 18,207
  • 7
  • 43
  • 71
3
votes
3 answers

Get job that ran SQL query on UPDATE trigger

I am trying to create an audit trail for actions that are performed within a web application, SQL server agent jobs and manually run queries to the database. I am trying to use triggers to catch updates, inserts and deletes on certain tables. In the…
anothershrubery
  • 20,461
  • 14
  • 53
  • 98
3
votes
2 answers

SQL Server 2008 - Execute sp_start_job from Insert Trigger - Does the job run asynchronously?

I wish to use sp_start_job to start a job from within an insert trigger. The table which the insert trigger is on only has a few inserts a day atm. The point of doing this is so that the insert trigger doesn't have to wait for the job to complete -…
2
votes
1 answer

How to resolve this error I am getting while running SQl Sever agent job?

A job, in which a proc is reading excel file using openrowset function and then exporting a file using bcp command. It was working perfectly until recently. When I run job it gives me this error:- NT AUTHORITY\LOCAL SERVICE. Cannot initialize the…
User13839404
  • 1,803
  • 12
  • 37
  • 46
2
votes
3 answers

How to schedule a database task?

Background: I created an application that measures a weight from a scale and saves the information in MS SQL server database. In the database, I want to save a record for the actual weight for every day as historical, and I don’t know what I have to…
Akrem
  • 5,033
  • 8
  • 37
  • 64
2
votes
1 answer

write to windows event viewer from sql server job

I am working with sql server 2012 and have some jobs set up on it to run at different times during the day. If the job fails I want to be alerted of such. On the server I have some software the monitors the event viewer. I would like to set up my…
amateur
  • 43,371
  • 65
  • 192
  • 320
1
vote
1 answer

Can I run SQL Server Job through Linked Server?

I have two SQL Server machines: SqlServer-1 SqlServer-2 I have a job created on SqlServer-1 named RunExeFile. SqlServer-2 can access SqlServer-1 through a linked server. Can I start the job RunExeFile from a stored procedure on SqlServer-2 ?
1
vote
1 answer

ISServerExec.exe crash when executing from SQL schedule job

I have ETL packages that works fine in Visual Studio 2019 When we deploy and run it from SQL Server Agent, it gives the error below Additional info: the package is set to "Encrypt sensitive with password" and we set the connection password in the…
Mohamed ElSheikh
  • 177
  • 1
  • 2
  • 9
1
vote
1 answer

Running batch file which runs 2 other batch files from SQL Server job

I have this step in sql server job AAA.bat content is this call BBB.bat call CCC.bat BBB.bat and CCC.bat each run ETL packages. When I run above step it throws error BBB.bat is not recognized as an internal or external command, operable program…
Eric Klaus
  • 923
  • 1
  • 9
  • 24
1
vote
1 answer

SQL Sever Agent Job Stop Failure if no file

I have a job in SQL Server 2014 that runs an executable which may or may not generate files. Afterwards the next step moves all the files generated to an SFTP site. Everything works if files exist. The problem is this task run every 10 minutes and…
Holmes IV
  • 1,673
  • 2
  • 23
  • 47
1
2 3 4