+ 2
I have some questions about replace method
i have sample number like 083232432111 and i want change two digit number from left "08" become "628".. can all of you help me solve this? i new in sql.
9 Respuestas
+ 5
there might be command in SQL too but you can do that by PHP too, as
$number=//number fetched from the database.
$number_replace=(string)$number;
str_replace("08","628",$number_replave,1);
mysqli//run SQL to update the changed number.
for whole row iterate over the query array with for loop
+ 1
hey makhija, it's just number and i just want to change two digits number from left "08" become "628"..
example 083232432111
become 6283232432111
i just need to know how SQL working bout it..
+ 1
i know that method.. but how if i have many number like
0836373727111
0817261818183
0827362718372
like that, i just want change "08" become "628" and my column names is b_number..
i have over 1000 number in b_number column with "08" from left, and i want changed all of it become "628"..
0
man
0
SELECT REPLACE(083232432111,08,628) FROM DUAL;
0
SELECT REPLACE (column_name, 08, 628 ) FROM table_name;
All '08' will be replaced by 628. If you want to only change starting 08 digits then include SUBSTR in this query.