Derived Column with backslash error/issue

Frank Sweeney 0 Reputation points
2023-01-23T19:41:59.7366667+00:00

I have searched a few hours on this issue and have not found anything specific to my issue. If there is, please direct me to any prior link.

I have a csv file with 13k rows. There are 2 random rows in this file with a backslash that someone manually entered into a free text field. Both of these backslash appearances are found inside one particular column that is 4th from the end of the file. The first appearance of this backslash occurs on line 2600. When I run my SSIS package with this backslash, it fails. When I manually delete the backslash in the actual csv file prior to running my package, it runs fine. So, I created a Derived Column in my package that would replace the backslash and eliminate any manual work on my part. I am using the following expression:

Replace(Client_Column, "[\]","")

When I run the package with this expression, it still fails. I receive the following error: "The Column Delimiter for column "Client_Column" was not found.

Now, when I go into the CSV file and move the row with the backslash from row 2600 to row 4, the package runs perfectly. Any idea what is happening? Am I doing something wrong? Am I better off just manually deleting the backslashes in the csv file prior to running the package?

Thanks

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

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 116.6K Reputation points MVP
    2023-01-24T21:46:35.6633333+00:00

    When you open the file and save it. The file may replace some settings with your IDE settings. Encoding?

    Yes, that is a likely explanation. Another possibilities are:

    • Removing trailing spaces.
    • Replacing tabs with spaces.
    • Changing newlines to CR-LF.
    • Adding missing line break at the end.

    Rather saving the file over the old file that does not work, save to a new file and verifies that it works. Then use a comparison tool find out the difference. I would recommend Beyond Compare. No, I am no way affiliated with them, but I'm a very happy user of Beyond Compare. The have comparisons for all sorts of files - including binary.

    1 person found this answer helpful.
    0 comments No comments

  2. Jingyang Li 5,896 Reputation points
    2023-01-23T20:06:46.3566667+00:00

    The backslash should not be the problem for your CSV file. Could you mock up a sample file to reproduce this issue? Thanks.

    0 comments No comments

  3. ZoeHui-MSFT 40,511 Reputation points
    2023-01-24T05:51:20.48+00:00

    Hi @Frank Sweeney

    If you want to replace the backslash in SSIS package, the expression should be like below:

    REPLACE(Client_Column,"\\","")
    

    User's image

    Please have a double check.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


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.