As I'm feeling a little bunged up and lazy today I thought I'd seek some SQL expertise in forum land...
I am normalising and standardising the 1,000 or so CoM questions and want to make some global edits on all of the text fields for each question and answer (five answers for each question).
All of the questions are in one table and each one has text (as well as a diagram as a BLOB) associated with it.
For each question I want to replace, for example, "black" with "Black".
I could write PHP code to do this but I'm hoping there is an SQL method for doing this.
Your help would be much appreciated!
SQL guru corner
- John Upham
- Posts: 8384
- Joined: Wed Apr 04, 2007 10:29 am
- Location: Cove, Hampshire, England.
- Contact:
SQL guru corner
Arbiter, Organiser, Swiss Mangler person, Rating Officer, Teacher, Coach and Photographer
British Chess News : britishchessnews.com
Twitter: @BritishChess
Facebook: facebook.com/groups/britishchess
British Chess News : britishchessnews.com
Twitter: @BritishChess
Facebook: facebook.com/groups/britishchess
- Carl Hibbard
- Posts: 6135
- Joined: Fri Dec 08, 2006 8:05 pm
- Location: Evesham
Re: SQL guru corner
Something like..
update questions set answer=replace(answer,'black','Black')
However I am on an iPad not a PC so take a backup first as that is off the top of my head
update questions set answer=replace(answer,'black','Black')
However I am on an iPad not a PC so take a backup first as that is off the top of my head
Cheers
Carl Hibbard
Carl Hibbard
- John Upham
- Posts: 8384
- Joined: Wed Apr 04, 2007 10:29 am
- Location: Cove, Hampshire, England.
- Contact:
Re: SQL guru corner
I'd just found the REPLACE function when your post landed!
Thanks Carl!
Thanks Carl!
Arbiter, Organiser, Swiss Mangler person, Rating Officer, Teacher, Coach and Photographer
British Chess News : britishchessnews.com
Twitter: @BritishChess
Facebook: facebook.com/groups/britishchess
British Chess News : britishchessnews.com
Twitter: @BritishChess
Facebook: facebook.com/groups/britishchess
- Carl Hibbard
- Posts: 6135
- Joined: Fri Dec 08, 2006 8:05 pm
- Location: Evesham
Re: SQL guru corner
I might have answered quicker but Angry Birds Halloween is more important!!
Cheers
Carl Hibbard
Carl Hibbard