Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Removing certain text from a column


Removing certain text from a column

Author
Message
ronan.healy
ronan.healy
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 232
Hi
i have been asked to do the following
b. If Asset Type = ‘IRS’ or ‘IFS’
i. Remove any leading text ‘IRS: Flo/Fix: ‘ or ‘IRS: Fix/Flo: ‘ or ‘INF SWAP: Flo/Fix: ‘ or ‘INF SWAP: Fix/Flo: ‘ or ‘IFS: INF: ‘ or ‘IFS: Flo/Fix: ‘ or ‘INF SWAP: Flo/Fix ‘
ii. Remove the proceeding text that starts with ‘ACT’


here is some example data from column



IRS: Fix/Flo: EUR FIXED 2.2795% ACT/ACT ANNUAL VS FRCPI ACT/365 24DEC22
IRS: Fix/Flo: EUR FIXED 2.59% 30/360 VS FLOATING FRCPI Index ACT/360 17Jan23
127869-IRS: Flo/Fix: P140000000EUR IrregularSpd 0% R14000000
IFS: INF: EUR Fixed 1.955% VS FRCPXTOB Index ACT/365 15Nov23
INF SWAP: Flo/Fix EUR Fixed 1.8475% 30/360 VS CPTFEMU ACT/360 21Nov25
138761-IRS: Flo/Fix: P107000000EUR IrregularSpd 0% R107000000EUR
139863-IRS: Fix/Flo: EUR Irregular@1.04% EUR IrregularSpd 0% (13/03/14-13/03/17)
140384-IRS: Flo/Fix: P138639000EUR IrregularSpd 0% R138639000EUR Irregular@1.745% (18/03/14-18/03/26)



Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8322 Visits: 19470
OK. Problem?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
ronan.healy
ronan.healy
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 232
im new to ssis so i dont really know how i can do this, so looking for advice help to do this
ronan.healy
ronan.healy
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 232
im new to ssis so i dont really know how i can do this, so looking for advice help to do this
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8322 Visits: 19470
What is the nature of this data - a flat file?

And you want to clean the data as part of an import to a db - is that right?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
ronan.healy
ronan.healy
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 232
sorry should have stated that but yes you have it spot on it reads in a flat file then i clean it up and into a db table
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8322 Visits: 19470
It's going to be tricky for a newbie, because the data seems to vary by 'type' and some techniques are required to get you through that.

Do you know what your intended output columns are? Do they vary by record type?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
ronan.healy
ronan.healy
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 232
yes its just going from 1 column in flat file to 1 column in a table just with the new fix up data.
so say its security name in the flat file and there is a column in table called security name and thats where it will end up depending on if it match the assetType= "ifs"
asset type is a different column all right
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8322 Visits: 19470
ronan.healy (7/30/2014)
yes its just going from 1 column in flat file to 1 column in a table just with the new fix up data.
so say its security name in the flat file and there is a column in table called security name and thats where it will end up


OK, great - so we're just dealing with a piece of text.

But imagine a single table full of these text chunks - not that useful, surely? So...

Will the target table have other stuff in it?

If so, how will you know which target row to update, based on the source data?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
ronan.healy
ronan.healy
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 232
every column in flat file has a coulmn connected to it in the db table.

and i have actually made a mistake. they way i was doing it is i read in flat file and that goes to a temp table. then from that table to my production table is where i want these changes to occur. does this make it any easier. sorry again for leaving this part out i thought it was coming straight from flat file source.


so it will go to the assettype column look up the word IFS and if it finds it makes the changes and enters it into new table
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search