Using REPLACE

  • Hi

    I have a requirement where I have replace two different strings with another string.

    i.e. if there is 'Brigade Army or "Brigades Armies' in the result set, it should be replaced with 'BAY'.

    How can I achieve it using REPLACE or any other way?

  • Nested replace will do that.

    REPLACE(REPLACE(SourceString,'Brigade Army','BAY'),'Brigades Armies','BAY')

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks Gail, thanks for your reply. That has worked for me.

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

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