May 9, 2017 at 1:47 pm
Hi All,
I am looking to check if there is a word, say "duck" with a hyphen directly in front of it, I want to add a space between them so it is "- duck" I would like to check this in SSIS while doing an import from a CSV file.
Thank you all in advance! I love this place!
~D
May 9, 2017 at 2:02 pm
You could do this in a Derived Column transformation, with an expression such as:REPLACE([ColumnName], "-duck", "- duck")
May 9, 2017 at 2:12 pm
Thanks Chris!
How would I do a derived column?
May 9, 2017 at 2:12 pm
Chris Harshman - Tuesday, May 9, 2017 2:02 PMYou could do this in a Derived Column transformation, with an expression such as:REPLACE([ColumnName], "-duck", "- duck")
Thanks Chris!
How would I do a derived column?
May 9, 2017 at 2:20 pm
in your SSIS Data Flow, one of the available Transformations is called Derived Column. Put that task between the source and destination tasks. Here's an article describing in more detail how to use it:
http://sqlblog.com/blogs/andy_leonard/archive/2009/02/04/ssis-expression-language-and-the-derived-column-transformation.aspx
May 9, 2017 at 9:11 pm
I can't speak to the SSIS part of this, but don't forget to allow for the possibility that a column could contain the " - duck" or "-duck" value. In other words, you may have to embed the REPLACE inside another REPLACE. The inner one would add the space after the dash and the second one would replace a double-space with a single space. Then again, there could be some other way in SSIS that I don't know about. Whatever you do, please don't use the equivalent of a CHARINDEX on the column in the WHERE clause because that means it'll have to read every row in the table and run the CHARINDDEX on it to determine which rows to update.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply