Advertisement

07.23.2008 at 10:38AM PDT, ID: 23589435 | Points: 250
[x]
Attachment Details

How to import a CSV file in SSIS into a table and get the input colum widths to match the target?

Asked by rschaeferhig in SQL Server 2005, Visual Studio .NET 2005

Tags: Microsoft, SQL Server, 2005, SSIS

I receive a CSV file from an outside source. I need to import it into a table where all the columns are varchar with varying widths depending on the data (i.e Email is 255, FirstName is 100, etc).

The standard SSIS Flat File Source in the Data Flow task sets all the columns to String(50). This is too long for some columns in the target table, resulting in erroneous truncation warnings, and too short for many other columns, resulting in truncated data and failures in the step.

I can go into the column definitions and manually set them all to match the target table schema, but that seems counter-productive and counter-intuitive for a product that is designed specifically to do this kind of work. Plus there are 83 columns in this table and that's a lot of drudge work for something I should be able to automate.

Has anyone run into this and found a way to solve it using automation? I suspect I could write a script task to iterate through the target schema and set the source column widths but I'm a newbie to SSIS and not sure where to start with that.

Any help would be greatly appreciated.Start Free Trial
 
Loading Advertisement...
 
[+][-]07.24.2008 at 06:50AM PDT, ID: 22079030

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 06:57AM PDT, ID: 22079128

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 07:16AM PDT, ID: 22079342

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 07:20AM PDT, ID: 22079393

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 07:21AM PDT, ID: 22079407

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 07:26AM PDT, ID: 22079476

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 07:43AM PDT, ID: 22079668

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628