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.
Author |
Topic |
mshsilver
Posting Yak Master
112 Posts |
Posted - 2012-01-10 : 10:16:00
|
Hi,I am trying to update a field (marketing) with any value already in that field (marketing) plus a hard coded text value (LC;) but can't seem to get it right. Below i use the + but i have tried it with an & too and that does not work either.Thanks for looking.update wce_contact set marketing = marketing +' LC;' where LC = 'yes' The error i am getting is:Msg 402, Level 16, State 1, Line 1The data types text and varchar are incompatible in the add operator. |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-10 : 10:21:26
|
create table expendable(marketing text)insert expendable select 'Testvalue'update expendable set marketing=convert(varchar(max),marketing) + ' bla'drop table expendable No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-10 : 10:22:25
|
and you should use datatype varchar(max) in your tables instead of text datatype. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
mshsilver
Posting Yak Master
112 Posts |
Posted - 2012-01-10 : 11:08:20
|
Perfect worked a treat, thank you! |
 |
|
|
|
|