Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Some basic sql syntax question

Author  Topic 

boltosaurus
Starting Member

7 Posts

Posted - 2011-11-26 : 05:09:17
Hi dear friends!

I have some sql syntax question (if it is not the right place to ask it - please tell me bout that) :)

I need to update all values in some column (varchar) of a table. In fact I just need to add one constant character to every value. For example - if the value is "helloworld" - I need to change it to "helloworld1".

I am a .net programmer, so I thought I can just write something like

UPDATE TABLE
SET COLUMNNAME += '1'

But that doesn't work and google search didn't help me so I'm just in a kind of confusion)

Can someone help me to solve this?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-11-26 : 06:08:10
This will work:

UPDATE TABLE
SET COLUMNNAME = COLUMNNAME + '1'
Go to Top of Page

boltosaurus
Starting Member

7 Posts

Posted - 2011-11-26 : 06:23:29
Tnx a lot, that works!
Go to Top of Page
   

- Advertisement -