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
 Updating colums

Author  Topic 

GavinD1977
Yak Posting Veteran

83 Posts

Posted - 2006-11-20 : 07:55:26
Hello all.

I have a column named 'RELATED' of type text in a table. I want to update the contents of this colums...........but still keep what is currently stored in it. Basically i want to add some text onto the end of the string it currently contains.

Any help would be much appreciated.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-20 : 08:01:45
use UPDATETEXT(). Something like this:

create table #t
(
a text
)

insert #t select 'abc'

DECLARE @ptrval binary(16),
@len int

SELECT @ptrval = TEXTPTR(a), @len = datalength(a) from #t

UPDATETEXT #t.a @ptrval @len 0 'pqr'

select * from #t


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -