Questions tagged [script-task]

The Script task provides code to perform functions that are not available in the built-in tasks and transformations that SQL Server Integration Services provides. The Script task can also combine functions in one script instead of using multiple tasks and transformations. You use the Script task for work that must be done once in a package (or once per enumerated object), instead than once per data row.

Do not use this tag for the SSIS Script Component, instead use .

Check the following article for more information: SSIS Script task vs. Script Component


Based on the official SSIS documentation, SSIS tasks are categorized as the following: Data Flow Task, data preparation tasks, workflow tasks, SQL Server tasks, Analysis Services tasks, maintenance tasks, custom tasks, and scripting tasks.

The SSIS Script Task extends the package functionality by using scripts. It performs functions that are not provided by the standard Integration services tasks.

363 questions
24
votes
3 answers

SSIS - How to access a RecordSet variable inside a Script Task

How do you access a RecordSet variable inside a Script Task?
GordyII
  • 7,067
  • 16
  • 51
  • 69
21
votes
2 answers

Connect to SQL database inside Script Task in SSIS

Inside of a Script Task in SSIS, I need to make a call to an SQL database. I have a connection string that was created when I added the database to the data sources folder, however now I'm not sure how to reference it inside the C# code. I know how…
NealR
  • 10,189
  • 61
  • 159
  • 299
17
votes
9 answers

"Runtime error Exception has been thrown by the target of an invocation" from Script task

I have a SSIS package with a script task, I get the following error when i try to run it in my local system. It works fine for my collegues as well as in production. However, I am not able to run it locally, to test. I keep a debug point in the main…
perplexedDev
  • 857
  • 4
  • 17
  • 49
15
votes
3 answers

SSIS Script Tasks losing code

I have a very strange issue happening that is causing Script Task code to clear out. I have been able to test on 2-3 different machines. We are running SSDT 15.4 preview. The steps to reproduce were as follows. Create a script task inside of a…
DataNerd
  • 349
  • 4
  • 12
6
votes
1 answer

How to avoid manually browsing DLL in Add Reference of Script Task when deploying package on production?

I use EPPlus.dll library for generating Excel files on the fly for attachment and generate mailer in Script Task of SSIS package. When there is new requirement for change in mailer comes, I do the change in Script Task on my local machine and send…
Mudassir Hasan
  • 28,083
  • 20
  • 99
  • 133
5
votes
1 answer

SSIS how to execute dll in script-task (SharePoint function not found)

I can not use a specific DLL in SSIS script-task. In c# console-project anything is fine. SSIS throws the error: Error: The Type "Microsoft.SharePoint.Client.ClientRuntimeContext" in assembly "Microsoft.SharePoint.Client, Version=14.0.0.0,…
user10705768
5
votes
2 answers

Get data from a full result set variable in to script task using C#

I need to get data from my SQL Task to a DataTable object using a script task to generate an email. But when I try to fill the data using OLEDB Adapter fill task, it generates an error: OleDbDataAdapter Internal error: invalid row set accessor:…
umair
  • 525
  • 5
  • 18
5
votes
1 answer

Powershell returns negative exit code while script results are correct

I have made the following PowerShell script: Set-Location D:\folder1\folder2\folder3\folder4; Get-ChildItem | Rename-Item -NewName {$_.BaseName.insert(19,'loadtime') + (Get-Date -Format HHmm) + $_.Extension}; The goal is to rename a file by adding…
Ruben Jonkers
  • 119
  • 1
  • 2
  • 10
5
votes
1 answer

SSIS Script Task- Connecting the ADO.NET and populating DataTable

I need to connect to a SQL Server db thru a script task in order to populate a DataTable, I'm using ADO.Net provider/connection. However for the life of me I'm getting all sorts of errors. For example, when using the SqlAdapter I get an invalid…
joeCarpenter
  • 1,495
  • 4
  • 19
  • 32
5
votes
1 answer

SSIS Script Task : How to log to output using Dts.Log

I searched a lot for this but no luck. I have a script task and inside that I've written some C# code. I have a look and I want to print output like what we see in Output Window I'm using Dts.Log() using below code: Dts.Log("List of files are…
FLICKER
  • 6,439
  • 4
  • 45
  • 75
4
votes
1 answer

SSIS package fails to process all rows with C# Script task when started with SQL Server Agent

I have a requirement to build a SSIS package that sends HTML formatted emails and then saves the emails as tiff files. I have created a script task that processes the necessary records and then coverts the HTML code to the tiff. I have split the…
peston
  • 61
  • 5
4
votes
1 answer

Use nuget packages in script task

I am trying to make Microsoft.Azure.Services.AppAuthentication and its dependencies work with SSIS script task. How do I resolve assembly reference errors? static ScriptMain() { AppDomain.CurrentDomain.AssemblyResolve += new…
pbj
  • 663
  • 1
  • 8
  • 19
4
votes
1 answer

change target framework to net 5 in ssis 2019 script task

I am trying to change the target framework for my SSIS 2019 script task to .NET 5.0 from .NET 4.7 by installing other frameworks. My changes are reverted back to .NET 4.7 once I save and close out from the script task. Could you please guide me on…
ITHelpGuy
  • 969
  • 1
  • 15
  • 34
4
votes
4 answers

Could not find a part of the path in 'C:\' at line 0

I am stuck with an error on Script Task in SSIS package. I could found similar questions but they are different from my scenario. Build the Script and which was failed with following error (for Error list please refer following image): Severity …
Pugal
  • 539
  • 5
  • 20
4
votes
1 answer

Failing to read String value from an excel column

SSIS script task reading only numeric values of excel but fails to read the alphanumeric values present in the same column I've tried using IMEX=0, IMEX=1 and IMEX=2. But the Alphanumeric values are being generated as NULL in my SQL server…
Aritra Sarkar
  • 225
  • 4
  • 13
1
2 3
24 25