I am trying to replace the first character which is a zero with the letter O. I have thousands of records I need to do this on. 1st is what they look like in DB and second is what I need them to look like.
01 need to look like O1
02 O2
03 O3
04 O4
05 O5
06 O6
07 O7
08 O8
The field name is strGrade. how can I do an replace and update.
thanks
CCongdon, The author asked to replace the first letter...which happened to be 0.
CCongdon
And that's fine. If that is really what he needs, then by all rights, you deserve the points.
However, I'm sure you both are experienced enough around here to find that sometimes what was originally posted isn't what the author really wanted. I should apologize however, my comments shouldn't have been directed AT you two, but more at your code as reference for kdeutsch, so that the questioner knows what the difference in the 3 code samples is.
chapmandew
No worries...I've answered a lot of questions...I've also commented on a LOT of questions where I thought I knew what the asker was asking, but they ended up asking something entirely different. :)
Heh, been there done that. Thought for dang sure I knew what it was supposed to be...and woops...missed a word (or two) in the description! Defintintely a couple of questions where I walked away without making any more comments because I felt I had egg all over my face.
kdeutsch
ASKER
Ok,
My original post is what I wanted, unfortunely I did not give all info. I have other data in there that is like
E5
E6
E7
The 1st post by Chapmandew replaced these but I did a select before an update to make sure data was good.
The second one by lsavidge works just fine.
But I like the 3rd one the best by CCongdon because I can use it for other fields in my table.
Because I used Isavidges to do my table, I will award most points here but feel obligated to add points and share with others becuase they are all correct.
kdeutsch
ASKER
I based points off of whom gave best solution first.
Use the replace function:
declare @myoutput varchar(2)
select myInputCol = replace(myInputCol, '0', 'O') from myTable
Regards,
Lee