Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying TEXT from one row to another

Status
Not open for further replies.

DavidJA

Programmer
Jan 10, 2002
58
AU
Hey all, I'm sure the answer to this is obvious AND simple, but I just can't get it!

I have a row in a database that contains a varchar(50) column and a TEXT column. I want to copy the values of these two columns to another row, withing a stored procedure.

Keeping in mind that text can not be used as a local variable, how can I do this?

I've tried:

UPDATE tasks_tbl set tasks_tbl.copy = tblSourceTask.Copy,
tasks_tbl.Heading = tblSourceTask.Heading
FROM tasks_tbl, tasks_tbl as tblSourceTask
WHERE tasks_tbl.taskid = @destinationTaskID
AND tblSourceTask.TaskID = @sourceTaskID


...but I just can't get anyware!
 
Look up READTEXT, WRITETEXT, and other TEXT functions in SQL Server Books onliine. TEXT columns cannot be handled with simple SQL statements. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Thanks for that, but now I'm really confused!

From what I can tell, I need to call WriteText and pass the data argument as the result of ReadText, but because I can not create a local variable of type TEXT, I'm lost!

I've tried:
DECLARE @ptrSourceText varbinary(16)
DECLARE @ptrDestText varbinary(16)

SELECT @ptrSourceText = TEXTPTR(copy)
FROM tasks_tbl
WHERE taskNumber = 86285

SELECT @ptrDestText = TEXTPTR(copy)
FROM tasks_tbl
WHERE taskNumber = 86286
WriteText tasks_tbl.copy @ptrDestText READTEXT tasks_tbl.copy @ptrSourceText 0 0

but it does not work....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top