SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS Strange error when running as SQL Agent


SSIS Strange error when running as SQL Agent

Author
Message
Wesley Middendorff
Wesley Middendorff
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 98
So I have a package that runs correctly from my local machine in BIDs, but gives the following error when run from the server agent as it attempts to import a particular csv file:

Executed as user: mast_hodc\SYS-DBAProxy1. Microsoft (R) SQL Server Execute Package Utility Version 10.0.2531.0 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 7:21:07 AM

Error: 2014-05-23 07:21:28.52 Code: 0xC02020A1 Source: Data Flow Task Flat File Source [1]
Description: Data conversion failed.0 The data conversion for column "AGENT" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.". End

Error Error: 2014-05-23 07:21:28.53 Code: 0xC020902A Source: Data Flow Task Flat File Source [1] Description: The "output column "AGENT" (10)" failed because truncation occurred, and the truncation row disposition on "output column "AGENT" (10)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component. End

Error Error: 2014-05-23 07:21:28.54 Code: 0xC0202092 Source: Data Flow Task Flat File Source [1] Description: An error occurred while processing file "\\A0136-fil0100-s\teamchwrfba\DecypherExtract\tracker_export.20140522.csv" on data row 2. End

Error Error: 2014-05-23 07:21:28.55 Code: 0xC0047038 Source: Data Flow Task SSIS.Pipeline Description: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Flat File Source" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. End

Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 7:21:07 AM Finished: 7:21:31 AM Elapsed: 23.821 seconds. The package execution failed. The step failed.


So far I have:

1) attempted to change the data types on the flat file source. Currently the AGENT column is set to length 6. When changing the data type of all columns to DT_STR(4000) and set all the destination table columns to VARCHAR(MAX) it still throws errors.
2) set the data to go to an error table. The data appears to be as expected in these cases
3) changed the encoding of the source file. The original format of UTF-8 Without BOM is the same type as generated by notepad so I don't see how this could be the problem either. I have also tried ANSI.
4) checked SP versions on both server and local machine. They are the same.


Sample of the data as collected from the error output:

AGENT,CUSTOMER,POLICY_NUMBER,LOAD_DATE,ATTEMPT_COUNTER,CALL_DATE,CALL_TIME,STATUS,ADDI_STATUS,LIST
"xxxxxx","xxx xxxxxxxx","999999999","05/22/2014","1","05/22/2014","90048","A","","9100"

I realize there must be some difference between the server and my local setup, but for the life of me I cannot figure out what would cause something so strange. Any and all help is appreciated.

Wes
Paul Hernández
Paul Hernández
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1090 Visits: 661
Hi Wesley,

could you try to change the data type in the Flat File Source to DT_WSTR (nvarchar).

I know it is only a workaround and does not explain why your package is not running correctly but I think it could work.

Please let us know your results.

Kind Regards,

Paul Hernández
Wesley Middendorff
Wesley Middendorff
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 98
Sorry it has taken so long to get back to this, I really do appreciate the suggestion.

I tried the solution suggested, but it is still throwing the same error. I also tried making all of the destination columns nvarchar(max) with no success.
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: General Forum Members
Points: 62169 Visits: 13297
The error means that either the column is too short, or that you are using the wrong code page.

When you changed the length of the columns, did you do that on the flat file connection manager?

The file is encoded in UTF-8, which is unicode, but not exactly unicode :-)
Try using the datatype DT_STR with code page 65001.
More info:

SSIS, Flat Files And Accents (é, è, …)


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
viresh29
viresh29
SSC Veteran
SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)

Group: General Forum Members
Points: 242 Visits: 335
This error you are getting has lots of possibilities. Is your file has text qualifier??
If yes then you might have " " empty space in between and your destination column data type is integer.
SSIS cant process " " empty space as an int. you need to convert it as null and then process it as int.

Second possibility is Column Delimiter.


You are getting this error because of Column Delimiter.

I had the same issue. Open your file in notepad++ check your column delimiter and change accordingly in flat file connection.

Thanks:-)



Viresh
--------------------------------------------------------------------------
“ The future belongs to those who are virile, to whom it is a pleasure to live, to create, to whet their intelligence on that of the others. ”
— Sir Henri Deterding
viresh29
viresh29
SSC Veteran
SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)

Group: General Forum Members
Points: 242 Visits: 335
The column after "A" is "" that means it's empty so SSIS takes empty space as string.

You are getting error because your destination column is Integer.
You need to convert empty space into NULL

Use derive column and in that change empty space into NULL

for example Write expression in derived column
[ColumnName] == " " ? (NULL, DT_WSTR,20) : [ColumnName]

This will convert " " into NULL. and you can process your file.

Please let me know If you still get that error.I had the same issue and I resolve it.

Thanks:-)



Viresh
--------------------------------------------------------------------------
“ The future belongs to those who are virile, to whom it is a pleasure to live, to create, to whet their intelligence on that of the others. ”
— Sir Henri Deterding
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: General Forum Members
Points: 62169 Visits: 13297
viresh29 (6/4/2014)
The column after "A" is "" that means it's empty so SSIS takes empty space as string.

You are getting error because your destination column is Integer.
You need to convert empty space into NULL

Use derive column and in that change empty space into NULL

for example Write expression in derived column
[ColumnName] == " " ? (NULL, DT_WSTR,20) : [ColumnName]

This will convert " " into NULL. and you can process your file.

Please let me know If you still get that error.I had the same issue and I resolve it.


Nope, implicit conversion takes care of that problem. An empty string is converted to 0.

declare @test int;

set @test = '';

select @test;




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
viresh29
viresh29
SSC Veteran
SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)

Group: General Forum Members
Points: 242 Visits: 335
Yes It will convert it to 0. But I had the same issue and I used derive column with above expression and converted empty space into NULL and then I use Data Conversion Task. That will convert string to int.

"CampaignID","CampaignName","BrandID","CreationDate","StartDate","EndDate","SegmentationType","DefaultTargetAudience","MasterCampaignID"
"115323","F'11 Chunky CBI/CHU/10","16171","7/22/2010 1:07:05 PM","1/1/2010 12:00:00 AM","9/30/2011 11:59:00 PM"," "," "," "

This above is my data that i was working on. And I process " " as Null.

Thanks:-)



Viresh
--------------------------------------------------------------------------
“ The future belongs to those who are virile, to whom it is a pleasure to live, to create, to whet their intelligence on that of the others. ”
— Sir Henri Deterding
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: General Forum Members
Points: 62169 Visits: 13297
viresh29 (6/4/2014)
Yes It will convert it to 0. But I had the same issue and I used derive column with above expression and converted empty space into NULL and then I use Data Conversion Task. That will convert string to int.

"CampaignID","CampaignName","BrandID","CreationDate","StartDate","EndDate","SegmentationType","DefaultTargetAudience","MasterCampaignID"
"115323","F'11 Chunky CBI/CHU/10","16171","7/22/2010 1:07:05 PM","1/1/2010 12:00:00 AM","9/30/2011 11:59:00 PM"," "," "," "

This above is my data that i was working on. And I process " " as Null.


All fine and dandy, but it still doesn't solve the OP's problem.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
viresh29
viresh29
SSC Veteran
SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)SSC Veteran (242 reputation)

Group: General Forum Members
Points: 242 Visits: 335
As with My data I created one file and table Here I am attaching both.


If you create package and It will throw you error at row 2.

Thanks:-)



Viresh
--------------------------------------------------------------------------
“ The future belongs to those who are virile, to whom it is a pleasure to live, to create, to whet their intelligence on that of the others. ”
— Sir Henri Deterding
Attachments
Display_Campaigns.txt (18 views, 261 bytes)
table.txt (39 views, 389 bytes)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search