I know this must be simple, but I am stumpped, please help!
I am writing a stored procedure in SQL 2000 where an incomming variable is a string of characters (a couple of sentences) and I want to add that to the existing string of characters in a table field called "Comments".
I do not know how to append the text in a field. How is that best done?
The basic function of the procedure is to take whatever string is passed to it and append it to the current contents of the field "Comments". As the procedure is ran over and over again, the field is constantly appended with the incomming text.
What is the best way to do this? Can anyone give me an example?update tablename set fieldname = fieldname + @.incomingtext where condition ...|||Also, if you haven't already, you may want to look at the data type of the "comments" field and make sure when you are appending the next text the maximum length for that data type is not being exceeded.|||Originally posted by Donner
Also, if you haven't already, you may want to look at the data type of the "comments" field and make sure when you are appending the next text the maximum length for that data type is not being exceeded.
create table test(id int identity,code varchar(50))
go
insert test(code) values('a')
go
update test set code=code+'b' where datalength(code+'b')<51
go
select * from test
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment