a sample of it looks like this in my table with new line breaks and all. This is just one sample of the questions, I have about 15 of these groups of questions with different question/answers combos. All follow the same format question: answer <new line break>
Phone Number: 1234567890
School Name: UCLA
Major: Economics
Graduation Date: 06/2012
Birthday: 01/01/1990
I need to run some update statements to make this data look like this.
~Phone Number: 1234567890
~School Name: UCLA
~Major: Economics
~Graduation Date: 06/2012
~Birthday: 01/01/1990
Now this example has 5 lines. However there are fields with 10 lines of questions and answers.
Individually these are pretty strait forward replace statements and my sql looks like this.
select
replace(notes, 'Phone Number: ', '~Phone Number: '),
replace(notes, 'School Name: ', '~School Name: '),
replace(notes, 'Major:', '~Major: '),
replace(notes, 'Graduation Date: ', '~Graduation Date: '),
replace(notes, 'Birthday: ', '~Birthday: ')
from notes
where ...
I can run update statements piecemeal, but I would like to run one update statement and update each group (this is one group here) with one update statement.
Thank you
replacestatements so you end up with 5 nested replaces. SQL Server doesn't support regular expressions