Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

SSIS Strange error when running as SQL Agent Expand / Collapse
Author
Message
Posted Friday, May 23, 2014 9:47 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 1:23 PM
Points: 135, Visits: 90
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
Post #1574118
Posted Monday, May 26, 2014 6:02 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 21, 2014 3:46 AM
Points: 115, Visits: 472
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
http://hernandezpaul.wordpress.com/
https://twitter.com/paul_eng
Post #1574505
Posted Monday, June 2, 2014 2:00 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 1:23 PM
Points: 135, Visits: 90
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.
Post #1576757
Posted Monday, June 2, 2014 2:05 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:55 PM
Points: 13,357, Visits: 10,222
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?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1576760
Posted Wednesday, June 4, 2014 2:07 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 26, 2014 6:54 AM
Points: 29, Visits: 178
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
Post #1577529
Posted Wednesday, June 4, 2014 2:12 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 26, 2014 6:54 AM
Points: 29, Visits: 178
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
Post #1577530
Posted Wednesday, June 4, 2014 2:15 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:55 PM
Points: 13,357, Visits: 10,222
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?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1577531
Posted Wednesday, June 4, 2014 2:29 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 26, 2014 6:54 AM
Points: 29, Visits: 178
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
Post #1577539
Posted Wednesday, June 4, 2014 2:36 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:55 PM
Points: 13,357, Visits: 10,222
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?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1577548
Posted Wednesday, June 4, 2014 2:51 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 26, 2014 6:54 AM
Points: 29, Visits: 178
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


  Post Attachments 
Display_Campaigns.txt (2 views, 261 bytes)
table.txt (1 view, 389 bytes)
Post #1577562
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse