Remove or Replace unwanted Characters from a table

  • Hi,

    I have some Tables that I want to transform in SSIS.

    Any occurences of more than one comma or other Character (|,/ etc..) should be removed leaving just one.

    This needs to be applied to the whole Table.

    Can anyone advise the best way to do this in SSIS?

    Thanks

  • Use an ExecuteSQL task and do it in T-SQL using REPLACE with the standard trick. For example, for commas:

    SELECT REPLACE(
    REPLACE(
    REPLACE(
    ',,,,,,too many commas in this drivel ,,,,,,,,,,,,,,,,,,, some dodgy test here ,,,,, adjhakj ,,,,,,,,,'
    ,','
    ,'<>'
    )
    ,'><'
    ,''
    )
    ,'<>'
    ,','
    );

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Thanks Phil,

    Much appreciated.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply