Updating text column

  • I'm trying to append data from a text field and two varchar fields to a text field.

    These fields are stored in 3 other tables linked by an id.

    Can UPDATETEXT be used for this ?

  • Yes but you will have to update the text column one row at a time and once for each source data using a pointer for the source text and a variable for the varchars.

    e.g.

    DECLARE @sptr binary(16)
    
    DECLARE @dptr binary(16)
    DECLARE @var varchar(n)
    SELECT @dptr = TEXTPTR(textcol) FROM desttable WHERE [id] = 1
    SELECT @sptr = TEXTPTR(textcol) FROM table1 WHERE [id] = 1
    UPDATETEXT desttable.textcol @dptr NULL 0 table1.textcol @sptr
    SET @var = ''
    SELECT @var FROM table2 WHERE [id] = 1
    UPDATETEXT desttable.textcol @dptr NULL 0 @d
    SET @var = ''
    SELECT @var FROM table3 WHERE [id] = 1
    UPDATETEXT desttable.textcol @dptr NULL 0 @d

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply