SSIS Strange error when running as SQL Agent

  • 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

  • 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
  • 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.

  • 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 (é, è, …)[/url]

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • 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

  • 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

  • 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-2 int;

    set @test-2 = '';

    select @test-2;

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • 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

  • 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.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • 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

  • viresh29 (6/4/2014)


    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.

    Well, first of all, the data in your example are not empty strings, but a single space.

    Secondly, if you configure the last column to be an integer in the flat file connection manager and you import actual empty strings (instead of a space), the flat file loads just fine.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • All of the responses are much appreciated and I thought I would just provide an update on my particular situation. After messing with the file's contents, I found the row delimiter (LF) to be causing an issue for some reason. If I update the file manually to have row delimiters of CR+LF I am able to get it to import, so I will just be asking the provider of the file to update the process on their end. None of this solves why it doesn't work from the server and does work in BIDS, but I will take it as a moral victory 🙂

  • Glad you got it resolved (sort of ;-)) and thanks for posting back!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply