Update Column prefixes each value

Hi Guys

I have a simple issue and I can't work it out.

I need to write a Microsoft SQL script.

I have a table called Notes.
It includes 2 colums ID AND Note

I would like to go through each note prefixes the note with zz_

Any help highly appreciated

Shezad AhmedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh RetnakaranDatabase AdministratorCommented:
are u looking to update all the notes

UPDATE Notes
SET Note = 'zz_' + Note

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TextReportCommented:
You can do this in your select

SELECT ID, 'zz_' + Note AS Note
FROM Notes

You may want to include the WHERE if Note can be NULL, please note (no pun intended) that if Note is Null it will return a Null when you do 'zz_' + Note

UPDATE Notes
SET Note = 'zz_' + Note
WHERE Note IS NOT NULL

Cheers, Andrew
0
LowfatspreadCommented:
sql server database?  (which version ?)

what is the datatype of the notes column?

update Notes
 set Note = 'zz_' + note
 Where substring(Note,1,3) <> 'zz_'


 
0
Shezad AhmedAuthor Commented:
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.