Quantcast
Channel: SQL Server Integration Services forum
Viewing all 24688 articles
Browse latest View live

Need help with loading XML list data using SSIS

$
0
0

Greetings all, I have tried everything that I can think to load XML list data with repeating values in SSIS, can someone help, appreciate and thanks.

Here is the data:

<DATUMOFFSETList>
<DATUMOFFSET>0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00</DATUMOFFSET>
</DATUMOFFSETList>


SSIS: same type of the value and variable, but getting error claiming that they differ

$
0
0

Hi, this is funny. 

I got Execute SQL Task with SQLStatement as stored procedure; also I have Result Set configured there. I created package variable of 'DBNull' data type to handle result set (and pass it into Foreach Loop Container as a next step). Testing Execute SQL Task itself and getting error 'the type of the value (DBNull) being assigned to variable differs from the current variable type (DBNull)'. Data type is equal! What the thing? Please advise.

[Execute SQL Task] Error: The value type (__ComObject) can only be converted to variables of type Object.

$
0
0

Hi we run 2017 std. The tail end of my single row resultset query is shown below in the code block, a bit anonymized. I'm getting an error mapping the output (command) to an ssis string variable called extractCommand. Presumably because of the varchar(max) portion.  This error follows the first in the progress pane.

[Execute SQL Task] Error: An error occurred while assigning a value to variable "extractCommand": "The type of the value (DBNull) being assigned to variable "User::extractCommand" differs from the current variable type (String). Variables may not change type during execution. Variable types are strict, except for variables of type Object.
".

The query being generated dynamically ends up being close to 21k bytes in length for 22 locations.  The generating query runs fine in ssms and the generated query runs fine in the db where it is intended to run. 

Its my understanding so far that sql wont even run this unless the first item in the string_agg function has a data type (thus the casts) big enough to hold the results.  The generated query ends up looking something like this and the number of conditions in parens separated by "or" for each location is not necessarily the same as the others...

select ... from location1_replicated.dbo.tbl where (id=... and dt >... and dt <= ...) or (...) or (...) union all select ... from location2_replicated.dbo.tbl where (...) ....

The compound predicates were built separately, one row for each location in #predicates.

Does anybody know of an elegant way around this problem?

select substring(command,12,len(command)-11) command
from
(
select string_agg(cast(' union all select ' as varchar(max))+ '''' + a.loccode + '''' +' loccode,* from ' + case when a.loccode='abc' then 'xyz' else a.loccode end + '_replicated.dbo.tbl where ' + b.[predicate],'') command 
from #whichlocs a
join #predicates b
on a.loccode=b.loccode
) x

 

SSIS scripting component builds fine in VSTA IDE but doesn't run when deployed?

$
0
0

Can anyone help me better understand how the scripting works in an SSIS package?

I'm confused because often my code will compile in the IDE, but when I deploy it to the SQL Server and execute it, it throws compilation errors.

For example, this compiles fine in the IDE (the Target framework is .NET Framework 4.5.1):

    public class C
    {
        public List<string> P { get; set; } = new List<string>();
    }

But SSIS gives me these errors:

    Error: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
    Error: CS1519 - Invalid token '=' in class, struct, or interface member declaration, main.cs, 175, 45
    Error: CS1519 - Invalid token '(' in class, struct, or interface member declaration, main.cs, 175, 63
    Error: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
    Error: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
    Error: "Map and Validate Columns" failed validation and returned validation status "VS_ISBROKEN".

Can I upgrade the version SSIS is using?

Also, can I attach a debugger to the code running in SSIS?

System.RuntimeMethodHandle.InvokeMethod error

$
0
0

Getting below error for the script task which has below code. Please advise.

     

  public void Main()
        {
            string packageName = Dts.Variables["System::PackageName"].Value.ToString();
            string taskName = Dts.Variables["System::TaskName"].Value.ToString();
            string subComponent = packageName + "." + taskName;
            bool fireAgain = true;

            int tableCount = Convert.ToInt32(Dts.Variables["User::TableCount"].Value);
            int intPkgParam = Convert.ToInt32(Dts.Variables["$Package::IntPkgParam"].Value);
            string stringPkgParam = Dts.Variables["$Package::StringPkgParam"].Value.ToString();
            int intProjParam = Convert.ToInt32(Dts.Variables["$Project::IntProjParam"].Value);
            string stringProjParam = Dts.Variables["$Project::StringProjParam"].Value.ToString();

            string msg = "Table Count: " + tableCount.ToString();
            Dts.Events.FireInformation(1001, subComponent, msg, "", 0, ref fireAgain);

            msg = "Package Parameters: IntPkgParam = " + intPkgParam.ToString() + " ; StringPkgParam = " + stringPkgParam;
            Dts.Events.FireInformation(1001, subComponent, msg,"", 0, ref fireAgain);

            msg = "Project Parameters: IntProjParam = " +intProjParam.ToString() + " ; StringProjParam = " + stringProjParam;
            Dts.Events.FireInformation(1001, subComponent, msg, "", 0, ref fireAgain);

            Dts.TaskResult = (int)ScriptResults.Success;
        }

Error :

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

Unicode to ANSI

$
0
0


My problem is that I need to extract data from SAP system which has data residing in the Unicode format. Downstream in extraction process, I need to  convert the data in Unicode format to ANSI. I understand that there is a mechanism to create ANSI views of Unicode data or may be just convert it to ANSI either in SSIS or TSQL. any inputs will be highly appreciated.

Is it possible to use a Golang SQL Server Driver to pull SSIS information

$
0
0

Scenario: I'm trying to do work on some SSIS manipulations in Golang. I've seen that there is a mssql driver denisenkom/go-mssqldb. My main goal is to either "watch" or locally copy the .dtsx files to the machine running Go. 

1. I'm not sure if this is something that is possible with this driver? Maybe there's a different driver I should be using
2. If this is the right driver, then I'm not sure what commands I should be mimicking from something like SSMS. 
3. Any other feedback/assistance on this would be super helpful!

CSV file matadata validation

$
0
0
Hi All,

I have a requirement of validating CSV file before loading into staged-folder, and later have to load into sql table.
I need to validate metadata (the structure of the file must be same as target sql table)
No. of columns should be equal to the target sql table
order of columns should be same as target sql table
Data types of columns (no text values should exist in numeric field of csv file)
looking for some easy and efficient way achieve this.
Thanks for help

Import Excel file

$
0
0

I have two multiple sheets excel files that have the same content but different extensions,PersonalInformation.xls and PersonalInformation.xlsx. Each of these excel file has two sheets named asPeople and State. I used two separate, parallel tasks to count the number of records in each sheet and shows the result in a message box.

When I set PersonalInformation.xls  in excel connection manager and run the package, its execution completes, a messagebox is shown that shows the the number of records in each sheets, People and State

In case of setting PersonalInformation.xlsx in excel connection manager and running it, the packages remains executing and no message box is shown.

The below images are for the case of reading the rows of each sheet in PersonalInformation.xlsx

Where is the problem,why the second package does not complete?

How To Delete Bottom N Rows From Excel File in SSIS Package

$
0
0

Hi,

I need to load data from excel file to SQL database but my excel file bottom 2 rows having company information which i need to delete while loading into SQL database using script task.

I am able to delete bottom 2 rows, if source is flatfile using below script in script task but same script is not working for Excel file.

Declared below 2 variables in ssis package.

User::VarFilePath: Contains source file path

User::VarDeleteBottomNRows: Holds the rows to be deleted from bottom (i.e. 2)

#region Namespacesusing System.IO;using System.Linq;#endregionpublicvoid Main() {// TODO: Add your code herestring FilePath = Dts.Variables["User::VarFilePath"].Value.ToString(); Int32 DeleteBottomNRows = Convert.ToInt32(Dts.Variables["VarDeleteBottomNRows"].Value);string[] lines = System.IO.File.ReadAllLines(FilePath); Array.Reverse(lines); lines= lines.Skip(DeleteBottomNRows).ToArray(); Array.Reverse(lines); System.IO.StreamWriter file =new System.IO.StreamWriter(FilePath); foreach (string line in lines) { // MessageBox.Show(line.ToString()); file.WriteLine(line); } file.Close(); Dts.TaskResult = (int)ScriptResults.Success; }Please suggest how to fix this issue using script task.

Thanks,

Visu

Forcing a failure for an execute SQL task - SSIS 2014-2016

$
0
0

Hi,

I'm trying to force manually a failure for an execute SQL task in order to trigger an OnError event managed with the related handler.

I've used a script task inside an OnProgress event handler by setting Dts.TaskResult to failure and also I've set the ForceExecutionResult to failure but in both cases unsuccessfully.

Now, how could I try the right behaviour about the OnError event handler of my execute SQL task?

Thanks

Package variable values setup to read from package configurations changes to gibberish characters

$
0
0
I am running in a weird issues that I have never encountered before and was hoping to get this help from experts. I am developing a package in VS2010. Now for this project we need to package configuration model (similar to SSIS 2008) and not used parameters in job. Now I am setting few values from the SQL database (see screeshot1). The issue I am getting is when I enable package configuration the variables values that are setup this way (in variable window) change to gibberish characters and package fails on run time. I looked up in the database table in case data is encrypted or something but it's plain text so nothing there. Not sure what is causing only the values for those setup using package configuration (screenshot2) to change?

Unable to create an Excel Connection Manager not recognized as a valid connection type.

$
0
0

Suddenly, after the most recent Microsoft update (day before yesterday), SSIS no longer recognizes Excel as a valid connection manager type. The SSIS packages have been working well for over a year.   Here is the error message

TITLE: Microsoft Visual Studio
------------------------------

The new connection manager could not be created.

------------------------------
ADDITIONAL INFORMATION:

The connection type "EXCEL, {8FD37A45-01A4-210C-6C6D-575139717076}" specified for connection manager "{F118BC96-4456-4B60-A69F-1E69A7BACCFF}" is not recognized as a valid connection manager type. This error is returned when an attempt is made to create a connection manager for an unknown connection type. Check the spelling in the connection type name.

------------------------------

I tried creating a new Excel connection manager, and that didn't work either.

I'm running SQL Server 2017 and the most current version of SSDT (just downloaded and installed as an attempt to fix this issue).  The machine is 64-bit Windows 2012 R2.

I'm running Microsoft Office 365, but again, things have been running perfectly until today with SSIS accessing Excel.

My guess is that something, perhaps in yesterday's Windows update corrupted, whatever it is that SSDT needs to connect to an Excel data source, but that's only a guess.

Any possible solution?  Is there something I need to reinstall?  Please advise.


Getting a Derived column error

$
0
0

Hello,

I created a package and after writing 89,478 rows to the destination I am getting an error message.

Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "Derived Column" failed because error code 0xC0049064 occurred, and the error row disposition on "Derived Column.Outputs[Derived Column Output].Columns[bill_dt_Derived]" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.

I checked the source file and there is no blanks or NULL values. The destination column type is small datetime and my source column type is string.

This is how I am getting my derived column: (I am only taking the date piece from source)

(DT_DBDATE)TOKEN(bill_dt," ",1)

Thanks,

Ali.

Visual Studio Integration Services target version vs SQL Server SSISDB version compatibility

$
0
0
In an Visual Studio integration services project I can have Target server 2012,2014,2016,2017,2019

I noticed if I have a SQL Server 2017 SSISDB and upload Visual Studio integration services solution of target version 2012 at least first time I ran the solution from SSISDB it seems to upgrade and can take a long time doing that.

I didn't test all the scenarios.
It lets me deploy a Visual Studio Integration Services project of target version 2019 against a SQL Server 2012 SSISDB too.

Is it documented somewhere if Visual Studio target version and deployed version does not match what happens (should happen)?
If Visual studio version is lets say 2019 can we deploy to any SQL Server SSISDB version starting 2012 and up would that work?

Gokhan Varol


Getting a Derived column error

$
0
0

Hello,

I created a package and after writing 89,478 rows to the destination I am getting an error message.

Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "Derived Column" failed because error code 0xC0049064 occurred, and the error row disposition on "Derived Column.Outputs[Derived Column Output].Columns[bill_dt_Derived]" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.

I checked the source file and there is no blanks or NULL values. The destination column type is small datetime and my source column type is string.

This is how I am getting my derived column: (I am only taking the date piece from source)

(DT_DBDATE)TOKEN(bill_dt," ",1)

Any help is appreciated.

Thanks,

Ali.

output section in merge statement

$
0
0

Hi Gurus,

I am trying to implement update target table and capture old and current values in log table.

but i am able to capture only current records, Please let me share in information to achieve.

Here is the sample table . #source is table source, table #t1 is the target table and #t1_archive is the log table .

Please let me know if you need any more information from my side. Thanks

CREATE TABLE #Source(
     id INT
    , somedata VARCHAR(10)
    , someotherdata INT
    ,date_time datetime
    );
    
INSERT  INTO #Source
VALUES  ( 1, 'mmm', 200,getdate() ),
        ( 2, 'vvv', 200 ,getdate()),
   ( 3, 'ccc', 500,getdate());

CREATE TABLE #t1 (
     id INT
    , somedata VARCHAR(10)
    , someotherdata INT
    ,date_time datetime
    );
    
INSERT  INTO #t1
VALUES  ( 1, 'aaa', 200,getdate() ),
        ( 2, 'bbb', 200 ,getdate()),
   ( 3, 'ccc', 500,getdate());

Create table #t1_archive
(
     id int,
  somedata_old VARCHAR(10), somedata_new VARCHAR(10)
    , someotherdata_old INT,someotherdata_new int
    ,date_time_old datetime,date_time_new datetime
    )

OLEDB connection for MS Access 2016 in SSIS 2016 - not available or failure.

$
0
0

Existing system that works fine:

OS - Windows 2008 R2 server, MS Access 2013, SSIS - 2008/2012 , SQL server - 2008/2012, Visual Studio 2010.

New system that generates error:

OS - Windows 2016 server, MS Access 2016, SQL Server 2016, SSDT - Visual Studio 2015 Shell integrated .

Error:

Experiencing the following 3 errors at different tests.

The package failed to load due to error 0xC0010014 "One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.". This occurs when CPackage::LoadFromXML fails.
 (OpenAir Import slip table package)
------------------------------
Test connection failed because of an error in initializing provider. No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).
------------------------------
Test connection failed because of an error in initializing provider. Unrecognized database format 'C:\Folder\Imprt.accdb'.
------------------------------

What I am Trying:

A Daily Import for a db from Access to SQL Server using an old DTSX package (can't do it other way since Access tables are dropped and populated daily from another db). Everything works fine in the current setting. But in the new setting it fails (whether I use the existing package or create a brand new one). Failure is mainly in the OLEDB connection for the Source (for Access). ACE DB 12.0 is not  in the new system even after installing the 64 bit latest  .exe for the driver. All components are 64 bits old as well as new. I can use the Provider Native OLE DB.. for SSIS and link the file to test the connection successfully. But the Flow Task won't read the file and generates the first error. I switch to 32 bit driver and change the provider to MS 12.0 Access db engine OLE DB but it wont' connect and generate the second and third errors.

Are there any solutions to resolve this conflict? I went through a lots of threads and tried to apply all reasonable solutions and none worked. The old driver was common to both 32 & 64 bit version and worked. Now the dedicated drivers don't help much in these situations.

Any help will be much appreciated. Thanks in advance.



the OLE DB adapter cannot convert between types "DT_DBTimeStamp" and "DT_I4"

$
0
0
Can anyone help me to remove this error? Highly appreciate the help. I have already checked in advance data coming like DT_14.


Thanks

Read First Line of Text File SSIS VB Script

$
0
0
I am trying to find a way to open a text file read the first line into a string and then close the text file using SSIS VBScript. I have found several examples but none of them work.
Viewing all 24688 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>