Print Page | Close Window

SQL Updatetext

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9749
Printed Date: 31 March 2026 at 11:22pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: SQL Updatetext
Posted By: Gullanian
Subject: SQL Updatetext
Date Posted: 11 February 2004 at 2:53pm

Gotta finish my thinggy by this weekend, stuck on one thing (I asked ages ago and got an answer but lost message).

In a simple SQL query, how can I update a text field for SQL Server? 

update tbl set field = field &(or a + sign) "more"

doesnt work!

Thanks for any help.




Replies:
Posted By: Mart
Date Posted: 11 February 2004 at 2:54pm
update tbl set field = field + 'more'


Posted By: michael
Date Posted: 11 February 2004 at 6:43pm

No, can't do it that way with SQL and Text Fields, gotta use Updatetext and determine the text pointer. Quite a pain in the behind but what can you do. Here an example from SBOL

This example puts the text pointer into the local variable @ptrval, and then uses UPDATETEXT to update a spelling error.

USE pubs
GO
EXEC sp_dboption 'pubs', 'select into/bulkcopy', 'true'
GO
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(pr_info) 
   FROM pub_info pr, publishers p
      WHERE p.pub_id = pr.pub_id 
      AND p.pub_name = 'New Moon Books'
UPDATETEXT pub_info.pr_info @ptrval 88 1 'b' 
GO
EXEC sp_dboption 'pubs', 'select into/bulkcopy', 'false'
GO


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Gullanian
Date Posted: 11 February 2004 at 6:44pm
lol so much for so little.... is there a technical reason behind this or is it just a bad design?


Posted By: ljamal
Date Posted: 11 February 2004 at 7:12pm
Actually you can convert the text field ot a varchar and do the update without using updatetxt as long as the text field is smaller than 8000 characters.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net