SSIS Remove first word in Derived Column -
if word
(xxxx) british white
has had (xxxx) copied new field, how write expression remove (xxxx) leave british white?
british white
i have experimented trim both left , right seams remove spaces.
option 1: fix in post
assuming you're going sql file, stage data in table as-is , fix in final table.
update finaltable set column = substring(column, charindex( ' ' , column) + 1 , len( column ) ) pros
- preserve source in case want different later. (this huge pro people seem gloss over.)
- sql speaking easier others maintain (more people grok it) , can encapsulated in more places (stored procedure, managed code, etc.)
cons
- probably going stick update statement in ssis package anyway.
- io driven, if performance issue.
option 2: derived column
derived column syntax:
right(column,len(column) - findstring(column," ",1)) the 1 in findstring function means use first occurrence. if there no space, returns 0 , expression returns original column.
pros
- memory-driven.
- all business logic encapsulated in package.
cons
- not preserving source.
- have document somewhere outside package next guy knows what's going on.
Thanks for sharing this amazing post. SSIS Postgresql Write
ReplyDelete