473,408 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Adding text to a text column

Hi

I want to have a log so in my table i got a TEXT field called LOGG. I want to update this field with new data by adding more text to field.

I am using MS SQL

'test' + 'test' doesn't work . say you cant add 2 text to each other

concat('test','test') doesn't work . say that CONCAT isn't a built in function


this code works but is it really the best way to do? and how long can a varchar be?

Expand|Select|Wrap|Line Numbers
  1. UPDATE    GAMES
  2. SET LOGG =
  3. CAST(CAST(LOGG AS varchar(200)) + CAST('test' AS varchar(5)) AS text)
  4.  
  5. WHERE     (ID = 21)
Oct 9 '06 #1
3 21465
Hey,

Use this instead:
Expand|Select|Wrap|Line Numbers
  1. DECLARE @ptrval varbinary(16)
  2.  
  3.  
  4. SELECT @ptrval = TEXTPTR(LOGG)
  5. FROM GAMES
  6. WHERE ID = 21
  7.  
  8. UPDATETEXT GAMES.LOGG @ptrval NULL NULL 'your text'
  9.  
And varchar can be 8000 long.
Oct 9 '06 #2
Thanks for the help. worked perfekt.




Hey,

Use this instead:
Expand|Select|Wrap|Line Numbers
  1. DECLARE @ptrval varbinary(16)
  2.  
  3.  
  4. SELECT @ptrval = TEXTPTR(LOGG)
  5. FROM GAMES
  6. WHERE ID = 21
  7.  
  8. UPDATETEXT GAMES.LOGG @ptrval NULL NULL 'your text'
  9.  
And varchar can be 8000 long.
Oct 9 '06 #3
you can use this samlpe

UPDATE Yourtable SET Bemerkung = convert(varchar(2000),Bemerkung) + 'Yourtext hire ' WHERE ID= 111111
Nov 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Sue | last post by:
On code-behind page: (attributes set programatically for each of these elements) linkbutton added to tablecell textbox added to tablecell tablecells added to tablerow tablerow added to table...
3
by: Claudio Lapidus | last post by:
Hello Now perhaps this is a bit dumb, but... I just populated a new table via \copy. After that, I realize that perhaps is a good thing to have a row identifier in it, so I try clapidus=>...
3
by: MS | last post by:
What's the best way to "store" and display a value in a text box that changes from day to day. An example of this would be where the name of the user is manually typed in after using the datbase,...
2
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete...
0
by: Chris Millar | last post by:
I have a user control that i wish to extend to change the date when the user selects the numeric up down button. The code explains itself, hope someone can help. any ideas appreaciated.. ...
0
by: Andrew | last post by:
If item is a ListViewItem and str is a string, why do the following two lines not have the same effect ? item.SubItems.Add(new ListViewItem.ListViewSubItem()).Text = str;...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
1
by: Ben Ramsey | last post by:
I'm using PostgreSQL on a Windows 2000 server and cygwin. All is set up just fine. The database works just fine, and ASP is connecting to the database through a DSN just fine. The only problem I...
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.