Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004

    Unanswered: Copy Image data type from one table to another

    I've a column col1 of image data type in table1. I would like to copy the data from col1 to another image column col2 in table2. Before moving the value, checking has to be done to specify which col1 data from table1 is needed and the destination has to be checked too.

    Example: insert into col2
    (select col1 from table1 where table1_id =5)
    where table2_id =6

    Hence bcp wouldn't work. Can anyone suggest me a way to do it. I tried using writetext but then, i've to get data from col1 in a variable, which is not possible. Any suggestions would be very helpful.

    Thanks in advance.

  2. #2
    Join Date
    Sep 2004
    I found the way to do it. Here is the code:

    declare @ptrvalsource binary(16)

    DECLARE @ptrvaldest binary(16)

    select @ptrvalsource =textptr(col1) from table1 where table1_id = 5

    SELECT @ptrvaldest = TEXTPTR(col2) FROM table2 where table2_id=6

    updateTEXT table2.col2 @ptrvaldest 0 null table1.col1 @ptrvalsource


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts