sarfaraz Ahmed
sarfaraz Ahmed

Reputation: 159

How to change existing data format through query in MySQL

I have more than 50 000 records in my database, but problem is that contact number is saved with '-' format.

How I can update all records so contact number will be updated without '-'?

enter image description here

Upvotes: 1

Views: 153

Answers (1)

Jay Shankar Gupta
Jay Shankar Gupta

Reputation: 6088

You can use REPLACE(COLNAME, find_string, replace_with) in UPDATE Statement

UPDATE Table_Name
SET CONTACT_NO_1 = REPLACE(CONTACT_NO_1, '-', '')

Demo

http://sqlfiddle.com/#!9/d0cf5c/1

Upvotes: 3

Related Questions