Home » Databases » Sybase » ASE » str_replace function (ASE 12.5.0.3)

str_replace function (ASE 12.5.0.3)

Starting in ASE v12.5.0.3, we can use the str_replace:

create table #test (name char(255))
go

insert #test
  values
   ("NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF")
go 10

OUTPUT:

select * from #test
name                                                                                                                                                       
————————————————————————————————————————————
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ JJJ KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
(10 rows affected)

Update:

update #test set name = str_replace(name, 'JJJ', "REP")

Output:

select * from #test
name
————————————————————————————————————————————
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
NOULE NOULE NOULE NOULE SDLKJFL:JLKJ REP KKKH SDFLKJLIEWRH:LSIUH:LSDKJF                                                                              
(10 rows affected)
Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Facebook login by WP-FB-AutoConnect