Concatination of text in a TEXT data type in SQL s

Results 1 to 2 of 2

Thread: Concatination of text in a TEXT data type in SQL s

  1. #1
    Akhilesh Reddy Guest

    Default Concatination of text in a TEXT data type in SQL s

    I am trying to concatinate text in a text data type in a SQL 7 server. <BR><BR>I have found 2 ways of doing it<BR>1. <BR><BR>Update TableName set ColName = convert(varchar(255),ColName) + convert(varchar(255), &#039Text&#039)<BR><BR>2. Using UPDATETEXT.<BR><BR>I have found that both these methods limit the amount of text that can be entered. It is quite obvious why the first method limits the data. If i remove the 255 for charecter length in the first query then even less data is alowed. <BR><BR>Basically i need to allow a lot of text to be added to a text datatype without deleting the existing text.

  2. #2
    Join Date
    Dec 1969

    Default RE: Concatenation of text in a TEXT data type in S

    I don&#039t have or use SQL Server, but I had a similar problem with a DB2 database. The solution there was the function "CONCAT". At least with DB2, using it meant I didn&#039t need to convert the text to varchar(255). So I could just do<BR><BR>colname = CONCAT(colname, newtext)<BR><BR>No idea if this will work in SQL Server. I am sure it is a peculiarity of the particular DB. But I figure it can&#039t hurt to try it. (CONCAT is ANSI SQL, the plus operator is not, just incidentally.)<BR><BR>Only other idea: What is magic about varchar(255)? Why not convert to "long varchar" or SQL Server equivalent? (Again, "long varchar" is DB2&#039s name for any varchar( &#062; 255 ) ... your mileage with SQL Server may vary.)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts