Removing characters from a string

  • I need to remove the Xs from the following string:

     

    A1EC1XXXXXX-52

     

    How do I do this?

     

    Thanks,

     

    Dave

  • REPLACE('A1EC1XXXXXX-52','X','')

    Far away is close at hand in the images of elsewhere.
    Anon.

  • or

    STUFF('A1EC1XXXXXX-52',6,6,'')

    if they are not really X's

    Far away is close at hand in the images of elsewhere.
    Anon.

  • what I really want to do is drop them so it would read 'A1EC1-52'

  • That is what the REPLACE query I posted will do, try this in QA

    SELECT REPLACE('A1EC1XXXXXX-52','X','')

    and you will get

    A1EC1-52

    Far away is close at hand in the images of elsewhere.
    Anon.

  • That did the trick, many thanks

Viewing 6 posts - 1 through 5 (of 5 total)

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