sql server - Why is my Derived Column Expression Not Giving Me the Results I Expect? -


i extracting data excel sheet , transforming , loading sql server 2012. trying perform derived column transformation on column 'registrationnumber'.

the 'registrationnumber' in following formats , not fixed length:

###/#### ###/#### ###/#### ###/#### ###/#### ###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/ab xyz##/### xyz##/### abs###/#### abcsedg###fg/#### 

i need take left of '/' , put in column on sql server , have take right of '/' , put in different column in sql server:

the following expressions in derived column transformation:

derived column: registrationnumber derived column:  replace 'registrationnumber' expression: left([registationnumber],findstring([registrationnumber],"/",1) - 1) data type: unicode string [dt_wstr] length:  255  derived column: copy of registrationnumber derived column:  replace 'copy of registrationnumber' expression: right([copy of registrationnumber],findstring([copy of   registrationnumber],"/",1) - 1) data type: unicode string [dt_wstr] length:  255 

for of results did wanted. of them getting results following:

/#### ##/aa #/#### a###xy/#### 

the right expression should have results this:

####

note: left expression produced valid results

the following task flow:

excel source 

to copy column derived column ole db command

left "new" 2012 release of ssis i'm providing formulas use substring people still on 2005/2008

  • slashposition = findstring(registrationnumber,"/",1)
  • left = left(registrationnumber,(slashposition - 1))
  • subleft = substring(registrationnumber,1,(slashposition - 1))
  • right = right(registrationnumber,len(registrationnumber) - (slashposition))
  • subright = substring(registrationnumber,(slashposition + 1),len(registrationnumber) - slashposition)

enter image description here

at core of it, right call slicing off last n character length passing position slash found. instead, position length of string, less slash position

enter image description here

as excel vs cozyroc vs else. that'll opinion based have found have best success when can data in flat file format (delimited or fixed width). assuming that's not option, prefer write queries against excel use native table thing.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -