Questions tagged [sql-server-agent]

SQL Server Agent is a Microsoft Windows service that executes scheduled administrative tasks, which are called jobs. SQL Server Agent uses SQL Server to store job information. Jobs contain one or more job steps. Each step contains its own task, for example, backing up a database. SQL Server Agent can run a job on a schedule, in response to a specific event, or on demand.

From Microsoft.com:

SQL Server Agent is a Microsoft Windows service that executes scheduled administrative tasks, which are called jobs. SQL Server Agent uses SQL Server to store job information. Jobs contain one or more job steps. Each step contains its own task, for example, backing up a database. SQL Server Agent can run a job on a schedule, in response to a specific event, or on demand.

483 questions
1
vote
0 answers

Cannot access properties or methods for the Microsoft.SqlServer.Mangement.Smo.Agent.JobStep

I am accessing SQL Server Agent Job from C# application using SMO. The Job runs fine in SQL Server Agent but errors out when run from C# randomly with the error Cannot access properties or methods for…
1
vote
2 answers

Best Way to Create Nightly Replication of Sql Server Database

I want to create a job that runs every night. I have a database (MyDatabase) that I want to copy/replace my staging database with (MyDatabase_Stage). I presume the easiest way is to do something related to SQL Server Agent, but I have never done…
Brandon
  • 10,744
  • 18
  • 64
  • 97
1
vote
2 answers

Make REST call to API and save the result to Azure SQL every hour

I'm using this very useful SQLCLR script to make a REST call to an API and save the data on SQL Server on the fly. I have created a stored procedure that withdraws new data every hour so my data are always updated. I would like to have all this on…
Francesco Mantovani
  • 10,216
  • 13
  • 73
  • 113
1
vote
1 answer

SQL Server 2019 - Job (SSIS) fails with error "The system cannot find the file specified"

I am currently migrating a database from an old SQL Server 2012 to a new system running SQL Server 2019. In addition to the database I am also migrating several SQL Server Agent Jobs. One of these jobs consists of multiple different steps, one that…
Chris
  • 1,417
  • 4
  • 21
  • 53
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
0 answers

Sql Server 2019 (Fedora 32) - Msg 22022, Level 16, State 1, Line 0 SQLServerAgent is not currently running so it cannot be notified of this action

I am getting this error. Though Agent seems to be running I have checked running state by calling EXEC xp_servicecontrol 'querystate', 'SQLSERVERAGENT' And it shows "Stopped." Then I call EXEC xp_servicecontrol N'START',N'SQLServerAGENT'; And it…
1
vote
0 answers

SSIS Foreach file enumerator Not picking up files once deployed

I have a package that loads CSV files from a folder, I have setup a foreach file enumarator to loop through the directory and assigns the files that starts with "Example*.csv" including the extention. The package runs fine in SSDT but once i deploy…
1
vote
1 answer

SQL 2000 script to kill Agent job if it overuns

On a legacy SQL 2000 box that is awaiting upgrade Does anyone have a script to kill / abort a job in SQL Agent 2000 if it over runs a set duration or overlaps with another agent job. This is causing us a serious problem every few weeks a job overuns…
Chris Wood
  • 535
  • 9
  • 28
1
vote
1 answer

WinSCP script works fine manually, but failes when executed by SQL Server Agent Job

I have a WinSCP script that SFTPs a file from a remote server to a local directory. The script works fine when I execute it from the command line, but when I try to execute it as a command step in a SQL Server Agent job, the job fails. All the…
Canadian_Marine
  • 479
  • 1
  • 4
  • 10
1
vote
2 answers

SSIS Package failing when excecuted by a SQL Job

I have a SSIS package that works great on its own, and even when I execute the package on SSMS. The problem comes in when I set it up as a job. Here is what the error message is, and of course any help would be much appreciated:
1
vote
1 answer

SSIS Packages running on SQl Server Agent randomly cannot connect to Snowflake

For the past week, multiple SSIS packages running on SQL Server Agent that load data into Snowflake have started returning the follow message randomly. "Failed to acquire connection "snowflake". Connection may not be configured correctly or you may…
1
vote
0 answers

Microsoft SQL Server - SQL Server Agent with scheduled email using the - msdb.dbo.sp_send_dbmail - stored procedure truncates body of email

I have the below T-SQL script in SQL Server Agent, and it is scheduled to run at 7 AM and 7 PM everyday. DECLARE @Report_output nvarchar(4000); DECLARE @HourLapse_output real; DECLARE @ServerName_output nvarchar(50); DECLARE @Subject_output…
1
vote
1 answer

SQL Server Agent SSIS Package AcquireConnection Error

I have a basic SSIS package that pulls data from a Redshift database ODBC DSN connection and puts it in a SQL Server database using an OLEDB connection. When I test the connections in Visual Studio everything is successful. When I run the package in…
ptownbro
  • 1,240
  • 3
  • 26
  • 44
1
vote
1 answer

File System Task from SSIS not working in SQL Server Agent (no errors)

I have a File system Task that does some ETL (moves some .txt files, copies to other directory, renames) between servers. When I execute this package from Visual Studio, it works well, it copies the files from one server to the other, renames, and…
Baldie47
  • 1,148
  • 5
  • 16
  • 45
1
vote
1 answer

How to Conditionally format HTML TABLE in SQL SP

I created a SP to monitor SQL Server Agent Jobs and generating Email for the same in HTML Format. However, I want to conditionally format the Run Status column to be Red/Green based on cell value(TEXT-Success/Fail). Please find the code at…