Return to Snippet

Revision: 56446
at March 28, 2012 22:00 by jgomez


Initial Code
SELECT 
TRIM( BOTH  '\\\'' FROM clear ) 
FROM user 
WHERE 
SUBSTRING( clear, 1, 1 ) =  '\\'

UPDATE user 
SET clear = TRIM( BOTH  '\\\'' FROM clear ) 
WHERE 
SUBSTRING( clear, 1, 1 ) =  '\\'

Initial URL

                                

Initial Description
Example: There is a table, 'user', with a column, 'clear', containing values such as: 

`clear
--------
\'animal\'
\'pass'\
`

and we would like to retrieve 'animal' and 'pass' ( without the pre & post \' )

Initial Title
Find and Replace MySQL column with substring

Initial Tags
mysql

Initial Language
MySQL