Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Location
    Walnut Cove, NC
    Posts
    101

    Unanswered: Appending to a text field using UPDATE

    I would like to update a field that already has data in it and I dont' want to overwrite the existing text. Here is my existing statement

    UPDATE wr SET cf_notes = " + tmp_array(24) + " WHERE wr_id = " + data_temp(0)

    I would like to add cf_notes + tmp_array(24) to cf_notes. Is this possible in SQL? If so, what is the correct syntax. I have tried 6 different statements and I get a compile error on every statement.

    Thanks,

    SBR

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    create procedure spU_update_table_with_text (
    @key_field_value int,
    @text text = null)
    as
    declare @txtptr binary(16), @insert_offset int
    select @txtptr = textptr(text_field),
    @insert_offset = datalength(text_field) + 1 --or 2 if a space is needed
    from your_table
    where key_field = @key_field_value
    updatetext your_table.text_field @insert_offset 0 @text
    return
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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