vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| >I have a text field in my database that contain a significant amount of > > text, where I just want to go through each row and delete from the > string everything between <body> and </body>. > > Any ideas? With the tags: select substr(left(COLUMN,instr(COLUMN,'</body>')+length('</body>')-1),instr(COLUMN,'<body>')) from table; Without the tags: select substr(left(COLUMN,instr(COLUMN,'</body>')-1),instr(COLUMN,'<body>')+length('<body>')) from table; Regards Dimitre |
| ||||
| >>I have a text field in my database that contain a significant amount of >> >> text, where I just want to go through each row and delete from the >> string everything between <body> and </body>. [...] > select > substr(left(COLUMN,instr(COLUMN,'</body>')+length('</body>')-1),instr(COLUMN,'<body>')) > from table; [...] Misread the post So: 1. Backup your table. 2. If you want to delete <body> ... </body>, tags included: update TABLE set COLUMN=concat(left(COLUMN, instr(COLUMN,'<body>')-1), substr(COLUMN, instr(COLUMN,'</body>')+length('</body>'))); or If you want to delete <body> ... </body> and leave the tags: update TABLE set COLUMN=concat(left(COLUMN, instr(COLUMN,'<body>')+length('<body>')-1), substr(COLUMN, instr(COLUMN,'</body>'))); Regards Dimitre |