We help IT Professionals succeed at work.

SSIS 2012 package not working from SQL Server Agent job

s vapv
s vapv asked
on
806 Views
Last Modified: 2016-02-11
Hi,

We have created an SSIS package which reads csv files from shared path and processes it to dump data into SQL Server 2012. The package was initially developed in 2008 and upgraded to 2012 using SQL Server Data Tools, as our requirement required the packages to run from SQL Server 2012.

We scheduled the package as a sql server agent job and try to execute the job using proxy account. The proxy account has access to shared folder from where the csv files are read and has been given permission in the DB as well.  we encountered the below error -

Microsoft (R) SQL Server Execute Package Utility  Version 11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  1:56:18 AM  Error: 2014-11-13 01:56:20.52     Code: 0xC0202020     Source: Data Flow Task Flat File Source [27]     Description: The buffer type is not valid. Make sure the Pipeline layout and all components pass validation.  End Error  Error: 2014-11-13 01:56:20.52     Code: 0xC004701A     Source: Data Flow Task SSIS.Pipeline     Description: Flat File Source failed the pre-execute phase and returned error code 0xC0202020.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  1:56:18 AM  Finished: 1:56:20 AM  Elapsed:  2.23 seconds.  The package execution failed.  The step failed.,00:00:02,0,0,,,,0



When we tried to run the another package that was developed using SSDT  also, it failed to execute.  On setting the
package to run in 32 bit mode in the execution options tab of the job step, it works. We need to execute this in 64 bit mode only.

If anybody has encountered this issue, kindly let us know how to resolve this. Any help is highly appreciated.

Thanks,
svapv
Comment
Watch Question

Commented:
Open the package in SSDT, go to the dataflow module involved, open the flat file connector. Get it to read the file and show you a correct preview - deliberately change the format to, say, fixed width and then back to the correct format and be sure that the data can be seen correctly. Reset the columns and save the task. Save the package and re-deploy it. It should now be a 64-bit 2012 package and should work.

hth

Mike
s vapvArchitect

Author

Commented:
Thanks very much for your response.

We tried out what you mentioned, bu it didn't work. Actually the problem seems to be with the script component, the InputBuffer Row returns NULL in 64 bit execution, If we execute in 32-bit, it is working.

Is there any solution to fix the script component issue that are migrated from 2008 to 2012?

Commented:
Could you post more info about the job?  For example, a screengrab of the SSIS control and data flows would help with context! Your error very clearly states that it is a Flat File source generating the problem, not a script task, which you didn't mention before.  

Are you building the package on a 32-bit machine and then trying to run it on a 64-bit machine, by any chance (you might get the wrong library code included).

One other question: is it actually absolutely necessary to run it in 64-bit mode? Some things just don't, like the Excel I/O !  It may be a lot easier for you just to accept this one as a 32-bit package.

hth

Mike
EugeneZSQL SERVER EXPERT
CERTIFIED EXPERT

Commented:
keep 32 bit execution and move on
EugeneZSQL SERVER EXPERT
CERTIFIED EXPERT

Commented:

Commented:
Eugene7: s vapv is not using Excel for import, but a flat file connector (see text of error message and his original statements). However, if he is having problems with a script task then he may be using some included code that is 32-bit-only ... hence my suggestion that he consider remaining as a 32-bit operation if possible.

hth,   s vapv,

Mike
EugeneZSQL SERVER EXPERT
CERTIFIED EXPERT

Commented:
yes, it is correct
32 bit is still SSIS friend

Commented:
"yes, it is correct
32 bit is still SSIS friend"

Looks like you were in a hurry there. Could you explain please?

thx, Mike
EugeneZSQL SERVER EXPERT
CERTIFIED EXPERT

Commented:
please, see the posted above links, even some for excel - but they are self explanatory, unless you are asking for some specifics that would need this SISS  be reviewed in a SSDT, check what sql server edition was used to develop this SSIS (64 -32 bit), what office tool, what sql service, pack, was it upgraded, etc.   Even maybe redesign starting by generation a New SSIS via Export\import..
as you know, EE has limits to see the requestor  screen and read mind.
If it is what you are asking.

Thx
s vapvArchitect

Author

Commented:
Thanks for all your suggestions.

Yes, it was developed in 32-bit and we are trying to migrate it to 64-bit. As mentioned, the script component is the one creating the problem. We are using flat file connector and not excel, but the flat file source is csv. I understand that there could be a problem with any of the underlying components that is used in the script, maybe any of it is using 32- bit still. The script component is called for errored out rows in the flat file.

The script component  has the below code

/* Microsoft SQL Server Integration Services Script Component
*  Write scripts using Microsoft Visual C# 2008.
*  ScriptMain is the entry point class of the script.*/

using System;
using System.Text;

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
    #region Constant Varibles
    StringBuilder sbExceptionMail= new StringBuilder();
    string strErrorDescription = string.Empty;
    string strFileName = string.Empty;
    #endregion
    public override void PreExecute()
    {
        base.PreExecute();
        /*
          Add your code here for preprocessing or remove if not needed
        */
    }

    public override void PostExecute()
    {
        base.PostExecute();
        /*
          Add your code here for postprocessing or remove if not needed
          You can set read/write variables here, for example:
          Variables.MyIntVar = 100
         
        */
        Variables.vExceptionLogErrorMail = sbExceptionMail.ToString();
        //MessageBox.Show(sbExceptionMail.ToString());

       
     
   
    }

    public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        Row.ErrorDescription = ComponentMetaData.GetErrorDescription(Row.ErrorCode);
       strFileName=Row.FileType.ToString()+DateTime.Now.ToString("MMddyyyy");
       strErrorDescription = "The File " + strFileName + "Contains Following Error";
        sbExceptionMail.Append("<tr><td style='border: 1px solid black'>" + Row.FileType.ToString() + "</td><td style='border: 1px solid black'>" + DateTime.Now.ToString() + "</td><td style='border: 1px solid black'>"+strErrorDescription+"\n"+ Row.ErrorDescription.ToString() + "</td></tr>");
       
     
    }

}



Will try out your suggestions and keep you posted on the updates.

Thanks once again for your response.

Commented:
btw, is your development machine 64-bit or 32-bit?

Mike
s vapvArchitect

Author

Commented:
It's a 64-bit.

Thanks,
Svapv

Commented:
This may seem weird, but destroy the script task, complete the package without it, save it and close. Re-open and add the script task again - with a different name, and add the code again. Make the error message slightly different. Compile, save, and run the package. Then deploy and see if you still have the same problem. If so, consider seriously staying with 32bit for now.

hth

Mike
Architect
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
s vapvArchitect

Author

Commented:
worked after changing the machine

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.