How to handle pipe delimiter file in SSIS?

Sanjeev Kumar B G 0 Reputation points
2024-07-17T16:22:21.96+00:00

|Col1| |Col2|Col3|Col|


|101| |A|21|DC|

The values in the file starts with vertical bar(|). The first column's values are moved to 2nd column and 2nd column's values to 3rd when I tried delimiter approach.

How should I deal with it in SSIS to load the data into SQL server?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,973 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,590 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Greg Low 1,770 Reputation points Microsoft Regional Director
    2024-07-19T01:37:02.74+00:00

    Don't listen to all the comments about getting the input fixed first. While that's obviously desirable, in the real world we have to work with what we're given, just as Erland noted.

    When you have data like this: |101| |A|21|DC|

    And you set | as the delimiter, and there are 6 delimiters, then there are 7 columns output. These are the values:

    Column 1: blank string
    Column 2: 101
    Column 3: blank string
    Column 4: A
    Column 5: 21
    Column 6: DC
    Column 7: blank string

    And you can just select the required output columns in the Source transformation.

    I've created a detailed blog post to show you how to do each step. You'll find it here: https://blog.greglow.com/2024/07/19/ssis-reading-pipe-delimited-text-and-selecting-particular-output-columns/

    1 person found this answer helpful.
    0 comments No comments

  2. ZoeHui-MSFT 37,441 Reputation points
    2024-07-18T03:02:00.6833333+00:00

    Hi @Sanjeev Kumar B G,

    It is hard to do that via SSIS.

    Can you edit the source data in the file first so that it can use vertical bar(|) to delimite?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.