mysql - Delete characters if the row size more than 9-characters -


i have more 12000 rows in sql table , want delete exceed characters row if contains more 9 character.

before:

id----title 1-----great day summer 

after:

id----title 1-----great day 

use substring first 9 characters.

update tablename set title = substring(title,1,9) 

you can add clause make sure long values updated, keep transaction size down:

update tablename set title = substring(title,1,9) length(title) > 9 

(is length mysql?)


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

php - Improving script execution time -

How to provide Authorization & Authentication using Asp.net, C#? -