Questions tagged [sql-job]

A job is a specified series of operations performed sequentially

Jobs define an administrative task that can be executed one or more times (manually or via a schedule) and monitored for success or failure each time it executes

272 questions
4
votes
2 answers

How do I make a sql job step quit reporting failure

I have a sql job step like this Declare @Result varchar(255) exec myprocedure @Result = @Result output What I want to do: if @Result = 'Error' then mark the job as failed, how can I achieve that?
CruelIO
  • 18,196
  • 16
  • 40
  • 58
4
votes
1 answer

SQL server job dynamic schedule

I have a set of SQL server jobs and I want the schedule for them to be dynamic i.e. I want the next run date to come from a table. I have tried updating next_run_date in the sysjobschedules table and next_scheduled_run_date in sysjobactivity table…
evoandy
  • 630
  • 4
  • 16
  • 31
3
votes
1 answer

Using sql query on ssis server sql job using powershell

I want to invoke a sql query/SP on sql job in a ssis server using a powershell script but I don't know how to do that. I've used powershell to run sql queries on sql database but not jobs on ssis. Here is what I have till now- $ssisServer =…
HAH
  • 151
  • 1
  • 15
3
votes
1 answer

SQL Server Agent Job is not running

I have a job that is supposed to run every 11 AM and 8 PM. About two weeks ago, it started to not respect the schedule. The "fix" that I found was to start the job manually and then the job would restart respecting the schedule for a while but…
Hugo
  • 567
  • 1
  • 8
  • 18
3
votes
1 answer

SSIS Package Runs Manually but Not from SQL Job

I get series of Errors when SSIS package (deployed in file system) Executed from SQL Job , but same package works fine if executed manually. First Error : Directing the row to the error output failed with error code 0x80070057. Second Error :…
3
votes
2 answers

How to run a Job from a Stored Procedure in another server?

Is it possible to run a Job from a stored procedure located in a different server? If so, how?
Francisco Noriega
  • 13,725
  • 11
  • 47
  • 72
3
votes
2 answers

In SQL Server Jobs Two stored procedures Execute one by one or simultaneously?

I want to create a JOB in SQL Server 2012, to execute two related stored procedures. Exec my_First_Procedure Exec my_Second_Procedure If I create the JOB like above, the second one start the execution after the first one completed, or both the…
DineshDB
  • 5,998
  • 7
  • 33
  • 49
3
votes
1 answer

How to run powershell script using default credential from sql job agent

I am downloading a file from sharepoint. I have already scheduled the job in SQL job agent Its working fine when i use the following code $UserName = "xxxx" $PswdPath = "D:\securestring.txt" $SecurePassword = cat $PswdPath|…
3
votes
2 answers

How to schedule a job using sp_add_job to run every 10 seconds indefinitely?

How do I schedule a job using sp_add_job to run every 10 seconds indefinitely? I am not sure if I am using the right parameters on the sp_add_jobschedule. Below is the T-SQL code I am using. BEGIN TRY BEGIN TRAN DECLARE @jobId BINARY(16) --Add…
3
votes
1 answer

XML parsing:unexpected end of input, during execution of T-SQL job step

I have a piece of code that need to run as a recurrent SQL job. When running the code as simple query inside the SQL Server query editor it runs successfully and return the expected results (merging several lines from the XML into an existing…
Zack
  • 119
  • 2
  • 13
3
votes
3 answers

Schedule Script for SQL Jobs

How to schedule a SQL Jobs using SQL Script.I have around 80 SQL jobs. I want to schedule all my SQL jobs and get details of Job scheduled jobs using script. SELECT * FROM [msdb].[dbo].[sysjobschedules] The above query only gives me list of…
peter
  • 2,396
  • 6
  • 24
  • 29
3
votes
2 answers

Running SSIS from an SQL job by passing parameters

Is it possible to send parameters like @inputfile, @packagepath etc. to my sql job which will run my SSIS? Currently I am configuring my path, package name in the job properties itself to run it. I know one way is to define a command @command = exec…
Ujjwal Vaish
  • 373
  • 1
  • 7
  • 21
3
votes
4 answers

SQL - How to find currently running job steps through TSQL

I am writing a query to find currently running job in SQL (I know we can view it in Job Active Monitor, but I've a need to do in TSQL). Though I can query sysjobactivity table to find currently running job, it's nowhere telling what job step is…
user3138788
  • 53
  • 1
  • 1
  • 7
3
votes
1 answer

Job History in SQL Server

I am trying to solve some issues regarding SQL Server jobs history from last several days with no luck. I like to show job history data as see in Log File Viewer. I run queries and get data but i am confused on how to know which step belongs to job…
Ashish
  • 359
  • 1
  • 6
  • 13
3
votes
1 answer

SQL Server running slow

I have SQL job that runs every night which does various inserts/updates/deletes. The job contains 40 steps which mainly execute stored procedures. It's been running fine up until a week ago when suddenly the run time went up from 2.5 hours to over…
Pavan Dhariwal
  • 145
  • 1
  • 3
  • 15
1
2
3
18 19