Copying text data from table A to table B

Copying text data from table A to table B

Post by Jeff Emric » Sat, 14 Sep 2002 23:41:43



I'm trying to copy text data from one table to another.  I need to do
something like the following, but with text data:


from tableA
where some_column = some_criteria

insert tableB
   (destination_data)
values

Obviously, the above code will not work with text columns, but after reading
the BOL regarding READTEXT, WRITETEXT, etc it is not apparent to me how to
accomplish this.  It appears to me that even if I were to obtain a TEXTPTR
to the source_data column, there is no way to use WRITETEXT to do an insert
into a different table than the table where the TEXTPTR was obtained from.

The only restriction that I'm dealing with is that this must take place
within a stored procedure.  I'm also using SQL 7.

Thanks,

Jeff Emrich

 
 
 

Copying text data from table A to table B

Post by Anith Se » Sat, 14 Sep 2002 22:52:27


You cannot use a local variable to get the value of
text, since text variables can be used only as parameters
to UDF & SPs. You can try:

INSERT TableB
SELECT source_data
  FROM tableA
 WHERE some_column = some_criteria

--
- Anith