Results 1 to 2 of 2

Thread: replace chars in sybase

  1. #1
    Join Date
    Aug 2005
    Posts
    1

    replace chars in sybase

    Hi,
    Can anybody tell me equivalent command in Sybase for the following command in Oracle ?

    Select replace(‘abc|ert|rfrfrf|’,’|’,’;’) from dual ;

    Thanks in Advance

  2. #2
    Join Date
    Jul 2005
    Posts
    1
    I haven't worked in oracle. I presume you want to replace all | with ;. Sybase doesnt have a replace cmd. you have to use a combo of charindex and stuff to replace it.

    you could have the following to replace ur string.

    declare @my_var char(25)
    select @my_var = 'abc|ert|rfrfrf|'
    while charindex('|', @my_var) > 0
    begin
    select @my_var = stuff(@my_var, charindex('|', @my_var), 1, ';')
    end
    select @my_var

Posting Permissions

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