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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 UPDATE ...add on text?

Author  Topic 

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2005-03-02 : 18:27:02
Is this possible or how would you do this?

UPDATE tblFeePaid SET NotesText = NotesText & 'other'

Thanks!

Brenda

If it weren't for you guys, where would I be?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-03-02 : 18:31:09
UPDATE tblFeePaid SET NotesText = NotesText + ' other'

Concatenation is done with + in T-SQL.

Tara
Go to Top of Page

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2005-03-02 : 18:33:41
Hi Tara

I tried that before, but it gives me this error:

Invalid operator for data type. Operator equals add, type equals text.

Brenda

If it weren't for you guys, where would I be?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-03-02 : 18:36:10
So you need to use UPDATETEXT for text data, right? Have you seen that UPDATETEXT article that SQLTeam has?

Tara
Go to Top of Page

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2005-03-02 : 18:38:18
I thought UPDATETEXT was only for over 8000 chars. I don't need that. Or do I need to use that for this?

Brenda

If it weren't for you guys, where would I be?
Go to Top of Page

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2005-03-03 : 12:17:13
I'm trying this, but it won't work.
DECLARE @ptrval binary(16)
DECLARE @length int
SET @length = (SELECT Len(NotesText) FROM tblFeePaid WHERE Casenumber = '011-334719')

SELECT @ptrval = TEXTPTR(NotesText)
FROM tblFeePaid
WHERE Casenumber = '011-334719'
UPDATETEXT tblFeePaid.NotesText @ptrval length 1 'lowe'

I know you can get the length of a text field, but how else would I do this? It gives me this error: "Argument data type text is invalid for argument 1 of len function."

THanks for the help!

Brenda

If it weren't for you guys, where would I be?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-03-03 : 12:24:03
Do you really need this to be a text column?

and for text you use DATALENGTH()


Brett

8-)
Go to Top of Page

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2005-03-03 : 12:29:34
I guess I can use varchar(8000). That would probably better huh? But how can I update the text?

Brenda

If it weren't for you guys, where would I be?
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2005-03-03 : 14:51:57
see
http://www.mindsdoor.net/SQLTsql/InsertTextData.html

for appending text you don't need the length
UPDATETEXT tblFeePaid.NotesText @ptrval null 0 'lowe'

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -