495 questions
1
vote
1
answer
70
views
SQL agent Job is not working is not exporting all the records to flat file
I have created on SSIS(2019) package. The package is selecting the data from oracles tables in writing it to a flat file (CSV). The package is working perfectly in visual studio (SSIS designer). But ...
0
votes
1
answer
106
views
How to set up a SQL Server Agent job to run even if it overruns its next start time?
Let's say you have a SQL Server Agent job which has a schedule to run every day at 12 o'clock, and usually takes a few hours to run.
The problem is that sometimes it runs over 24 hours, it misses the ...
0
votes
0
answers
81
views
Unable to get SQL Server Agent Job to Run PowerShell script and populate table. When script is run natively data is populated
We have a PowerShell script that connects to an API and pulls report data. In the script we have an Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $Database -Query $Query -...
1
vote
0
answers
77
views
Query to link SSIS execution with SQL Server Agent job and jobstep
Finding the error message when a SSIS package has failed in a job, is cumbersome. First right-click the job to open log file viewer and see what step and package has failed. Then into Integration ...
1
vote
0
answers
95
views
How can I use WMI tokens in SQL Server Agent?
I've setup an SQL Server Agent alert to monitor for new files in a folder with the following query:
SELECT * FROM __InstanceOperationEvent WITHIN 10 WHERE TargetInstance ISA "...
0
votes
0
answers
75
views
PermissionError When Importing typing_extensions in Python Script Executed from SQL Server Agent
I am encountering a PermissionError when attempting to execute a Python script via SQL Server Agent. The script works fine in PyCharm and from the command line, but when run as a job I get the ...
0
votes
1
answer
349
views
How to find value for SSIS package project parameter manually set in the SQL Server Agent job?
I have a package called MyPackage. It is part of the project MyProject.
It has three parameters:
ParameterA, ParameterB, ParameterC
ParameterA is set through an environment
ParameterB is using the ...
4
votes
1
answer
476
views
What does "include step output in history"-setting control in SQL Server Agent for TSQL steps?
When you create a TSQL job step, there's an advanced setting called: "Include step output in history", but I don't understand what this setting controls:
A sample job script:
DECLARE @jobId ...
0
votes
0
answers
53
views
SQL Server Agent Job cannot run a query on audit log
I would like to send the result of the following query by mail every 15 minutes.
select
event_time, server_principal_name, application_name,
database_name, statement
from
sys....
0
votes
1
answer
230
views
Call log file viewer from T-SQL
I am viewing historic stored procedures in SQL Server by opening "Job Activity Monitor":
Right click on my job and select "View history":
which returns a table, which I then ...
0
votes
0
answers
195
views
How do you set a Parameter for an SSIS task in SQL Server Agent Job to Null when Required is set to False
When you first deploy a package and set up a job I can see some parameters are defaulted to NULL and it appears in italics so you know it is NULL value and not a NULL text. However, when you view the ...
0
votes
0
answers
182
views
SQL Server Agent Job Execution Based on a Trigger
I have following scenario to tackle some Production data gaps for various reports in a Datawarehouse:
We have few reporting tables, which get refreshed everyday with SQL server agent jobs. Jobs are ...
0
votes
0
answers
51
views
SSIS Package Generates Correct File Name in SSDT, but SQL Server Agent Job Uses Default Name
I have an SSIS package that generates a CSV output file with a dynamically generated name based on the current date and time. The expression for the file name is set in the FilePath variable within ...
0
votes
1
answer
82
views
Job step dependent on the availability of the database
I have a procedure that should be run just after databases are restored. For that, I want to make a job with 2 steps:
Checking the databases' status at time intervals
Procedure, triggering after Step ...
0
votes
0
answers
34
views
SQL Agent step with cursor not excuting for all databases [duplicate]
I have a SQL Agent job with a step that uses a cursor to run a DBCC CHECKDB for all databases. However, it randomly stops before it runs for all databases. The job succeeds, and I see no errors in ...
0
votes
2
answers
452
views
Disable SQL Server Agent job on failure
I have a daily scheduled SQL job on SSMS with multiple steps, if any of these steps fail, I want to disable the job in order to prevent the scheduled job from running the following day.
I have ...
2
votes
1
answer
2k
views
SSIS Job randomly succeeding, usually resulting in "Unexpected Termination"?
The Job looks like this, with a Script Task checking a directory for an (.xlsx) file of interest available for processing, and if found, marks a boolean variable for Precedence Constraint as {True}. ...
0
votes
0
answers
326
views
SSIS Package with 7-zip exe not working in SQL Server Agent
I created a SSIS package to extract zip files (which contains Csv files) using 7-zip then uploads the data into SQL Server. When I run it in Visual Studio, it worked perfectly, but when I run the job ...
0
votes
1
answer
271
views
Missing data in the SQL Server Agent Job Output to a File
I have below script which would give me the definitions of all the views in one of my DBs.
SELECT OBJECT_DEFINITION(object_id) FROM sys.objects WHERE[type] = 'V'
This works real good when I run it as ...
1
vote
0
answers
407
views
SSIS Script Task "Object reference not set to an instance of an object" When Executed from SQL Server Agent Job
I have a strange issue. I have an SSIS package that runs on a SQL Server Agent job. It intermittently fails with the error "Object reference not set to an instance of an object" and I can ...
-1
votes
1
answer
90
views
SQL Server Agent Run Python Script Issue
I can run basic Python scripts from SQL Server Agent using the CmdExec to run a bat file pointing to my py file that prints hello world. However when trying run a file that uses the pandas module the ...
0
votes
0
answers
62
views
Why can't SQL Server Agent be started?
A PC runs SQL Server 2016 (130).
I tried to start SQL Server Agent many times to no avail:
However, the Application group of Event Viewer shows it is started:
I found later the following in the ...
0
votes
1
answer
54
views
SSIS picks wrong date when querying oracle database on another server
While running SSIS etl package via SQL Server agent and filtering with TIME/date (expected date being current date minus 1) against an oracle database in another server, query returns date older than ...
-1
votes
1
answer
66
views
SQL Server Agent Job Creates a Blank Excel Workbook When No FIle is Present [closed]
I have SQL Server 2019 and running an SSIS package via SQL Server Agent on a schedule. The first step of the job runs the SSIS package to import an Excel file into a database table. If the file ...
0
votes
2
answers
81
views
Query not completely executed when used in DB job
I have the following statement, that when executed directly in an query window sends me the correct result as email
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQL Server Agent Notification',
...
0
votes
0
answers
1k
views
How to retrieve SSIS Packages and the associated tables from SQL Server?
I'm currently working on a documentation project related to SQL Server Integration Services (SSIS) packages that are executed through SQL Server Agent jobs. In other words, I want to create a mapping ...
0
votes
0
answers
296
views
How to run a bat file using Agent SQL Server (with administrator rights)
Please tell me, has anyone come across how to run a script / bat file as administrator through the SQL Server Agent
(Microsoft SQL Server 2016)?
I create a task in the agent (you need to clean files ...
0
votes
0
answers
130
views
SQL Server Agent Cannot Set Off .NET Core Console Job
I'm trying to set off a C# Console Job from SQL Server Agent to do some ETL work and running into an issue where it's as if the Agent isn't running at all.
This eventually led me to do a test...
I ...
0
votes
0
answers
447
views
'Invoke-Webrequest' works fine on prompt but fails when executed through
I am reading latest code from github to update the procs. It works well when I execute from powershell. But it fails when I do from SQL Server Agent Job. This is the format of my code
cd "C:\...
-2
votes
2
answers
357
views
SQL Server Jobs only finishing after I restart the Server Agent
I have 13 Sql jobs that run at night starting at 11:30pm. Most of them never finish. When I restart the sql agent job it and run the jobs manually it will run but when they run on their own they will ...
0
votes
2
answers
2k
views
SSIS package with Python Script doesn't run in a SQL Server Job
I have a question about running a Python script in a package. And then running that package in a Sql Server Job.
Goal
First, let me briefly describe what I would like to achieve: With a python script ...
0
votes
0
answers
73
views
Managing job in SSMS 19.0.1
I've created jobs with multiple steps that run a stored procedure for different variables. For each step, I've set retry attempts to 10 with 1 minute intervals. I've noticed that even though a step ...
0
votes
1
answer
194
views
CSV file locked by "another user" after creating through batch file/SSMS job
So I have this batch file that is running through SSMS SQL Server Agent as a job.
@echo off
title This will be the batch script to create our 3 .csv files for Scott.
sqlcmd /S MYSERVER /d QWI /E /Q &...
0
votes
1
answer
582
views
SQL Server Agent after upgrade
I upgraded SQL Server from 2016 to 2019. And after that the SQL Server Agent tries to start, but after 10 seconds it stops.
023-03-08 16:54:55 - ? [000] Event Global\sqlserverRecComplete opened
2023-...
0
votes
2
answers
4k
views
Microsoft SQL Server Agent Job: Get Schedule that triggered the Job
I have SQL Server Agent Job on my System that copies data into at table for later evaluation purposes. The Job runs on two types of schedules every Friday every week and last day of the month. The ...
0
votes
1
answer
152
views
SQL Server Agent job - How to use the same parameter on all steps
I have a SQL Server Agent job that has 10 steps. All of them need the same date as a parameter but I have to go through each step to update the parameter each time I run it (which is once per month). ...
1
vote
1
answer
303
views
SQL Server Management Studio will not redirect output from command line
I am using SQL Server Agent to run a few scripts regularly of type CmdExec with the following format:
"Absolute path to RScript.exe" "Absolute path to script.R" > "Absolute ...
0
votes
0
answers
197
views
SSIS ETL Population began hanging and now takes twice as long to complete
Can Someone explain what these codes are and how they might explain why my ETL Duration times have doubled in the last
few weeks?
select collationname(0x0904D00034)
sys.sp_describe_first_result_set;1
...
0
votes
0
answers
199
views
SQL Server Agent Job cannot kill a task on a machine
I have SSIS package which starts a task and then kills it via cmd. This works when executed directly from Visual Studio. However, task is not killed when SQL Server Agent executes a job with this ...
0
votes
0
answers
35
views
SQL Server Agent Cannot Run Job With Croatian Characters
I'm trying to run SSIS package with SQL Server Agent Job, but get a fail message. After analyzing I found that the job fails when trying to run Execute Process Task (EPT), which creates a network file ...
1
vote
1
answer
1k
views
SQL Server Agent in Azure SQL cloud Database
I have create a job in my SQL Sever Agent in my on prem database. Now I want to move my database to Azure Cloud database but how I can schedule my job at Azure cloud database? Can I use my ...
0
votes
2
answers
2k
views
Find SQL Server Job Related to Existing SSIS Package in Visual Studio
I've started working in the middle of an existing project and I want to identify the Job in SSMS which is running an existing package in visual studio (SSIS). Is there a way to do that or only ...
0
votes
1
answer
76
views
Difference in DateTime.TryParse when running app through SQL Agent and Task Scheduler [closed]
This has got me stumped... I have an application that I run from SQL Server Agent (Operating System cmdExec) that behaves differently to when it's run through Windows Task Scheduler or directly ...
0
votes
0
answers
79
views
SQL Server SSIS package suddenly throws conversion error (csv) ONLY when running in job - works fine running the package manually and on test server
This is a new problem that began about three weeks ago on several jobs that have been running for years without problems - with both SSIS Flat File Sources and script tasks. The error occurs on READ ...
0
votes
0
answers
2k
views
Automatically Save Query Results to Excel
I have a simple query that I want to run and save the results in excel file on daily basis.
I am trying to create a SSIS(SQL Server Integration Services) package to automate this thing.
My query is
...
0
votes
0
answers
666
views
Executed as user: NT Service\SQLSERVERAGENT. Exception calling "Send" with "1" argument(s): "Failure sending mail."
I've want to send mail from SQL Server. I have tried with Google account with the below mentioned Windows PowerShell Codes and it's been working perfectly.
Google account script:
$EmailTo = "...
0
votes
0
answers
185
views
Change Server IP and SQL Server Agent Not Execute Jobs
I changed the IP server that I have SQL Server on, now all the jobs I wrote on the old IP server, are not running on the new IP server. I get the error
Executed as user: NT SERVICE\SQLSERVERAGENT. ...
0
votes
1
answer
367
views
SQL Server Agent Job fails after upgrade to SQL Server 2017
I have upgraded a database server from SQL Server 2012 to SQL Server 2017. A SQL Server Agent Job that previously ran now fails with this error:
Unable to start execution of step 1
(reason: JobOwner ...
0
votes
0
answers
171
views
SQL server agent issues: Imports wizard + manual SSIS execution ok . SQL server agent fails --> Microsoft.ACE.OLEDB.12.0 not registered. 32/64bit
Trying to schedule an SSIS package to do a daily update from an excel file to a SQL server.
Imports fine in imports wizard, created the SSIS package, SSIS package manually executes fine, but when it ...
0
votes
1
answer
693
views
SQL Agent job failure universal handling
I'm in a situation where I have a server running sql 2012 with roughly two hundred scheduled jobs (all are SSIS package executions). I'm facing a directive from management where I need to run some ...