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
 Transact-SQL (2000)
 WRITETEXT how to

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-03 : 07:44:56
Paul writes "Good day. I have searched for this answer far and wide and have not found it. I hope you can help.

'Help me Obi Wan. You're our only hope.'

SQL 7
I am working on a stored procedure where data from one table is being copied into another table. The fields in question are text fields. Not my design, I'm cleaning up. I can't use a subquery because it is a text field. I want to use writetext but I can't seem to figure out how to get the source data to the destination. Here is what I have so far, basically copied from Books On Line.

declare @destination binary(16)
Select @destination = TEXTPTR(myDestination) from myDestinationTable
writetext myDestinationTable.myDestination @destination 'This text will be inserted.'


What I need is this.

declare @destination binary(16)
declare @source binary(16)
Select @source = TEXTPTR(mySource) from mySourceTable
Select @destination = myDestination from myDestinationTable
writetext myDestinationTable.myDestination @destination @source


I have tried adding a readtext in this as well. I end up with the binary pointer being written to the table and not the text. How can I do this OR is there a better way?

Thank you very much.

souLTower"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-06-03 : 12:00:46
If you want the whole text data copird you should be able to

update desttbl
set txtfld = s.txtfld
from desttbl d
join sourcetbl s
on s.id = xxx
and d.id = xxxx

If you want to manipulate the data you will have to do it in chunks as in
http://www.mindsdoor.net/SQLTsql/InsertTextData.html


==========================================
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 -