Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Posts
    47

    Unanswered: REPLACE function

    Has anyone written a function which does the same as REPLACE?

    I am trying to compare a list of company's while some have spaces in the name but are really the same company.

  2. #2
    Join Date
    Jun 2004
    Location
    Paris, France
    Posts
    43
    hi
    the function you're looking at is stuff()
    you'll find the entire syntax at :
    <http://manuals.sybase.com/onlinebooks/group-as/asg1250e/refman/@Generic__BookView;lang=fr?DwebQuery=stuff&DwebSea rchAll=1>

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Maybe this might help
    Code:
    select 
    str_replace(
    str_replace(
    str_replace(upper(name),',',null) -- delete comma
               ,'.',null)             -- delete full stop
               ,' ',null) as 'name'   -- delete space
    from (
    select 'oldeds' as 'name' union all
    select 'old eds' union all
    select 'old, eds' union all
    select 'old. eds' union all
    select 'OldEds' ) t1
    
    name
    ---------
    OLDEDS
    OLDEDS
    OLDEDS
    OLDEDS
    OLDEDS
    
    (5 rows affected)

  4. #4
    Join Date
    Apr 2006
    Posts
    6

    Cool bb

    Quote Originally Posted by pdreyer
    Maybe this might help
    Code:
    select 
    str_replace(
    str_replace(
    str_replace(upper(name),',',null) -- delete comma
               ,'.',null)             -- delete full stop
               ,' ',null) as 'name'   -- delete space
    from (
    select 'oldeds' as 'name' union all
    select 'old eds' union all
    select 'old, eds' union all
    select 'old. eds' union all
    select 'OldEds' ) t1
    
    name
    ---------
    OLDEDS
    OLDEDS
    OLDEDS
    OLDEDS
    OLDEDS
    
    (5 rows affected)

    Hi.......
    Now sybase 12.0 onwards there is inbuilt function str_repalce() which
    replace the character with another caharacter
    ex. select str_replace("your string","find cahar","replacing char")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •