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

How to solve Type cast error in Derived column

$
0
0

I have Delimited text file where I'm loading into Database table

In Text file

1. COL1 : Predicted delivery date : DT_STR Format

2.COL2  : ScanDateTime : DT_STR Format

In Destination Table :

1. COL1 : Predicted delivery date : DATE  (DataType)

2.COL2  : ScanDateTime : DATETIME and I need to load data in this below format

Switchoffset(Substring(ScanDateTime , 1, 22)+':'+Substring(ScanDateTime, 23, 24),'-05:00')

I have trying to load this data into destination table using Derived column :

I gave this expression for  Col 1  : (DT_DBDATE)LEFT([Predicted Delivery Date],10)

col2  : (DT_DATE)(SUBSTRING([ScanDateTime ],1,4) + "-" + SUBSTRING([ScanDateTime ],5,2)+ "-" + SUBSTRING([ScanDateTime ],7,2),'-05:00')

But both are giving error :

[Derived Column [2]] Error: An error occurred while attempting to perform a type cast.


[Derived Column [2]] 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[Predicted]" 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.

For Col1 : Predicted delivery date how I need to handle Null values and Load the data into Destination table which is Date Format

For Col2  : ScanDateTime : How I can write an expression for Switchoffset(exp) - 5hrs for that date time column and load  



Calling webservice API (dynamics 365) from SQL Sever (t-sql)

$
0
0

Hi there

Any suggestions most welcome.

Task: Using Web API, to query and populate Dynamics 365 later.  Restriction, no  SSIS allowed by the client.  Not used API before.

Issue: Authentication.  Receive blank response.  

My Code:

--Declarations

Declare @Object asInt;

Declare @ResponseText asVarchar(8000);

Declare @UserName nvarchar(100);

Declare @Password nvarchar(100);

DECLARE @oauth2 int;

DECLARE @hr int;

DECLARE @url nvarchar(4000);

DECLARE @iTmp0 int;

DECLARE @sTmp0 nvarchar(4000);

--Create Object

PRINT'Create Object'

EXEC @HR =sp_OACreateN'MSXML2.XMLHTTP',  @oauth2OUT;

PRINT @HR

IF @HR <> 0

    BEGIN

        PRINT'Failed to create ActiveX component'

        RETURN

    END

--Set properties for authentication.

PRINT'Set properties for authentication'

--EXEC sp_OASetProperty @oauth2, 'ListenPort', 3017

--EXEC sp_OASetProperty @oauth2, 'AuthorizationEndpoint', 'https://login.microsoftonline.com/ABC/oauth2/v2.0/authorize'

--EXEC sp_OASetProperty @oauth2, 'TokenEndpoint', 'https://login.microsoftonline.com/ABC/oauth2/v2.0/token'

--EXEC sp_OASetProperty @oauth2, 'ClientId', 'ABC'

--EXEC sp_OASetProperty @oauth2, 'ClientSecret', 'ABC'  --??

EXECsp_OASetProperty@oauth2,'Resource','https://ABC.api.crm11.dynamics.com'

EXECsp_OASetProperty@oauth2,'RedirectAllowHtml','<html><body><p>Thank you for granting access.</p></body></html>'

EXECsp_OASetProperty@oauth2,'RedirectDenyHtml','<html><body><p>Maybe next time...</p></body></html>'

EXECsp_OASetProperty@oauth2,'NtlmAuth', 1

EXECsp_OASetProperty@oauth2,'username','username'

EXECsp_OASetProperty@oauth2,'password','password'

PRINT'Start Authen'

EXECsp_OAMethod@oauth2,'StartAuth', @urlOUT

EXECsp_OAGetProperty@oauth2,'LastMethodSuccess', @iTmp0OUT

IF @iTmp0<> 1

      BEGIN

        EXEC sp_OAGetProperty@oauth2,'LastErrorText', @sTmp0OUT

        PRINT @sTmp0

        EXEC @hr =sp_OADestroy@oauth2

        RETURN

      END

Execsp_OAMethod@oauth2,'open',NULL,'get',

                'https://ABC.api.crm11.dynamics.com/api/data/v9.1/contacts?$select=contactid,firstname,%20lastname', 

                'false'

Execsp_OAMethod@oauth2,'send'

Execsp_OAMethod@oauth2,'responseText', @ResponseTextOUTPUT

Select @ResponseText

Connection manager usage

$
0
0

Hello

I have a package that uses multiple connection managers.  The package has 9 containers, each of which have 1 or more data flow tasks.

I need to know which connection manager is being use in each task, two are due to be replaced

Is there an easy way to do this besides manually go through each task or trying to read the xml file?

Thanks

Roy

How to convert DT_STR to DateTimeoffset in SSIS

$
0
0

I have delimited flat file where in need to export data to OLEDB Destination Table.

Input : SCanDatetime : DT_STR

which is below format

when I query this kind of Date format in T-SQL I follow this format :

Switchoffset (Substring(ScanDateTime,1,22)+':'+Substring(ScanDateTime,23,24),'-05:'-05:00')   to get DATETIMEOFFSET -5hrs

I have used Derived column to name it as Out date

and after that I used script and taken SCANDATETIME column to convert into DATETIMEOFFSET format and mapped that outdate into Destination table .

 

script in the component :

publicoverridevoidInput0_ProcessInputRow(Input0BufferRow)
{
   
if(!Row.ScanDateTime_IsNull&&!String.IsNullOrEmpty(Row.ScanDateTime)){

       
DateTime dtDate=DateTime.Parse(Row.ScanDateTime);

       
DateTimeOffset offDate=newDateTimeOffset(dtDate,
                              
TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time").GetUtcOffset(dtDate));

       
Row.outDate= offDate;

   
}else{

       
Row.outDate_IsNull=True;

   
}
}

But when I run the Package it is failing in the Derived Column itself

Error :

[Derived Column [2]] Error: An error occurred while attempting to perform a type cast.

[Derived Column [2]] 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[outdate]" 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.

 

could not create DTS.Application because of error 0x80040154

$
0
0

Hi,

We had recently Migrated SQL Server from 2008 to 2016.

We had created a new solution and upgraded the dtsx packages to SQL Server 2016 and is running locally(We are having Excel Manager Connection).

When we deployed the same package in the new server (which has SQL Server 2016) and try to run the package with 64 bit DTExec.exe it is showing an error "Microsoft OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 64-Bit driver is not installed, run the package in 32-bit mode". (We kept the Run64Bit to True)

So we installed 32-bit DTExec.exe and when executed the same package it is showing error as "could not create DTS.Application because of error 0x80040154"

Can someone help me to resolve this issue.

Thanks in advance

Unable to Debug Script Task in SSIS , SSDT 2017 Version 15.9.9

$
0
0

Unable to Debug SSIS script Task  SSDT 2017 Version 15.9.9.

Run64BitRuntime  has been set to false still it didnot worked . Please suggest 

Add additional columns from a temp table

$
0
0

Hi,

we have following tables:

Products (prodId, price)

OrderDetails (orderId, orderDetailsId, quantity, prodId).

In order to calculate the total amount for all orders i would write:

select orderId, (od.quantity*p.price) as orderTot

from OrderDetails OD, Products P

where p.prodId=OD.prodId

group by orderId

In order to find the most expensive order we can run MAX() on it:

select max(T.orderTot) from 

(

select orderId, (od.quantity*p.price) as orderTot

from OrderDetails OD, Products P

where p.prodId=OD.prodId

group by orderId

) T

My Question is - how do we present also the OrderId of the max order (most expensive order)?

Thank you.

How to compare packages in two different environments

$
0
0

Hi All,

Is there a way to compare packages in dev and test. I mean the differences.

Thanks


how do i do a minimal client tool install to execute SSIS packages

$
0
0

I am trying to migrate our processing from command line based scripts and foxpro to SQL so I need to run the SSIS packages using dtexec. I copied the dtexec file and a few dll's that are missing to our production servers but i cant execute the packages. I dont want to install the full client tools (particularly managment/business inteligence studio) on our production servers due to the overhead and limited system disk space.

Can somebody tell me what the minimum install would be so I would be able to run SSIS packages using the dtexec or dtexecui tools? I would also like to install some of the other command line client tools like osql etc.

SSIS not recognizing {CR}{LF}

$
0
0

Hi I am having a major problem with an SSIS package I am trying to write at the moment.  The SSIS package is supposed to read a csv file and import it into a table.  The issue I am having is that the file comes to me where the first 15 or so lines are terminated with a ,{CR}{LF}.

1,123,11,0,0,0,0,,,0000-00-00,

2,123,11,0,0,0,0,,,0000-00-00,

Then after the first 15 lines the row termination becomes a simple {CR}{LF}.

16,123,11,12,0,0,0,,,0000-00-00

The problem I am having is that at row 16 SSIS fails to recognize the {CR}{LF} and starts merging rows together so that row 16 and 17 appear as one row, row 18 and 19 appear as one row and so forth.  As far as I can determine is that it does not recognize the {CR}{LF} at the end of row 16 but then recognizes the {CR}{LF} at the end of row 17.  It does not make any sense.  I do have a script that runs prior to processing the file to remove unescaped quotes.

strInput = File.ReadAllText(strFilePath & "\Project_Task.csv", System.Text.Encoding.ASCII)

strInput = strInput.Replace(Chr(34) & Chr(34), "")

File.WriteAllText(strFilePath & "\Project_Task.csv", strInput)

And I tried adding the following line to try and remove the ,{CR}{LF} and replace it with a simple {CR}{LF} but that just made matters worse and the merging of rows happened accross all the lines then.

strInput = strInput.Replace("," & vbCrLf, vbCrLf)

Using TextPad I looked at the original CSV file and determined that it was encoded in ASCII, I am at a loss as to why this is happening.  If I open the file in excel it formats correctly, if I use SSIS the formating gets thrown off.  The file is a simple .CSV with a text qualifier of " column delimeter of , and a row delimeter of {CR}{LF}.

 

Anyhelp would be appreciated.

 

 

SQL Server Native Client file, SQLNCLIR11.rll gets deleted

$
0
0

We are running SSIS 2014 and every once in a while, the file C:\Windows\System32\1033\sqlnclir11.rllgets deleted; once we copy the file from another server things are fine. Any thoughts on why it would be deleted and what process triggers the deletion?

This is a production server and only a handful of people have access to this server. Hence it's certainly not a human that's deleting this file, but a process.

Thanks.

SQL On Insert Table Trigger Doesn't Run When Record Added Through SSIS

$
0
0

When a record in inserted into a specific table, I need database mail to get send out notifying that there's a new record in there. I setup a table trigger for on insert. This was tested successfully when just manually inserting a record in SQL Management Studio. Database mail gets sent out as expected. However, I have an SSIS package that runs on a schedule and it's doing the inserting. However, when a new record gets added to the table with the on insert trigger, no mail is sent out. I don't see a record of it at all in sysmail_allitems. Any idea why this would happen?

My trigger: 

ALTER TRIGGER [stg].[AlertNewRecord]
ON [stg].[ActiveList] 
AFTER INSERT
AS 
   EXEC msdb.dbo.sp_send_dbmail 
                        @profile_name = 'SMTPProfile', 
                        @recipients = 'myuser@mycompany.com' , 
                        @body = 'A new record is in this table.', 
                        @subject = 'New Record Created' 

مركز خدمة عملاء كاريير الجيزة @01225025360@01014723434@0235695244

how can we pass execute sql task sp result set into Dataflow task level

$
0
0
Executesql task sp result set into Dataflow task level

How to remove SQL Integration Services silently via command, script, or xml

$
0
0

Hello,

I need to remove SQL Integration Services silently via command, script, or xml. This is because I will be attempting to remove it from many systems at once via SCCM. 


Thomas Faherty


DFT Importing CSV file when count > 0 then do update statement with DFT

$
0
0

Good day,

I have a Loop > DFT that imports CSV files, if record count > 0 "not empty file" then do update statement within DFT

I don't want to be doing the OLEDB Source twice, I don't want to in DFT update the count then in next task based on count do update statement then do Import again to OLEDB Destination

I guess I can write the results to VarObject but I would still need to redo an Oledb source from variable

I would like to do all within 1 DataFlow as I have onsuccess/onfailure constraints.

Its also not a record level update statement, it updates a table based on a status and should not execute for every record

Please advise? Regards


Can I loop through a SQL table using the Foreach Item Enumerator?

$
0
0
I need to loop through records in a table and process them (I have the process part figured out).  I initially tried using the Foreach ADO Enumerator, but I'm having issues (errors) with the field variables.  I believe using the Foreach Item Enumerator would be a simpler and better maintenance-wise approach, but I'm not able to find anything related to the Foreach Item and recordset looping.  Is this possible?

Rambler_358

ForEach Loop ADO Enumerator Not Working

$
0
0

I've been working with SSIS for the past 13 years, so what I am trying to do is not something new. However this is the first time that I have seen this and I am stumped. I'm writing the results of a SQL query into a recordset destination. I'm then looping through that recordset using an ADO Enumerator to send out emails. In this case, even though I am loading the recordset, the for each loop is not populating the variable and nothing in the foreach loop runs.

Here is the dataflow task populating the recordset:

Here is the ForEach Loop Configuration:

Here is the script task configuration in the loop. Note this is completely simplified so I could try to figure out what is happening with the loop.

The task runs, but throws no errors. The 7 records added to the recordset should throw up a messagebox, but NOTHING happens. The task shows green, but nothing occurs within the loop.

This is my current configuration. 

Microsoft Visual Studio 2015 Shell (Integrated)
Version 14.0.25420.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: IDE Standard

Microsoft Visual Studio Tools for Applications 2015   00322-10000-00000-AA441
Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015   00322-10000-00000-AA441
Microsoft Visual Basic 2015

Visual C# 2015   00322-10000-00000-AA441
Microsoft Visual C# 2015

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

SQL Server Analysis Services   14.0.1016.232
Microsoft SQL Server Analysis Services Designer 
Version 14.0.1016.232

SQL Server Data Tools   14.0.61712.050
Microsoft SQL Server Data Tools

SQL Server Integration Services   
Microsoft SQL Server Integration Services Designer
Version 14.0.1000.169

SQL Server Reporting Services   14.0.1016.232
Microsoft SQL Server Reporting Services Designers 
Version 14.0.1016.232

TypeScript   1.8.34.0
TypeScript tools for Visual Studio

I should add that this package started out targeting SQL Server 2014. I copied it and targeted SQL Server 2016 due to a server upgrade. It's reading the SQL Server just fine.

I'm confused.

Oracle to SQL Data Conversion

$
0
0

Im trying a table conversion with VS2017 Community and SSDT15.xxx - From an Oracle 11c source to SQL 2017 Destination.

Used an Oracle Connection Manager and Oracle Source - Test connection works fine.

Used a OLE DB Destination connected to my local SQL DB, connection test ok.

Added a data conversion transformation inbetween.

When i try to run the package I get the error: 

Exception deserializing the package "Value does not fall within the expected range.". (Microsoft.DataTransformationServices.VsIntegration)

Can anyone point me in the right direction ? Could it be my data types not matching between source and destination ?

** I first had a SQL Server destination that gave a lot of data type issues, but i dont get that with the OLE DB Destination.

Can we deploy multiple SSIS projects in single deployment using TFS

$
0
0

Hi,

We are currently using TFS to deploy our SSIS projects individually. each project will have atleast 4 to 5 dtsx packages. Is there a way we can deploy multiple projects in one go instead of deploying individual packages? 


Aparanjit

Viewing all 24688 articles
Browse latest View live


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