Hello fellow monks,

I'm trying to append some text to a column in a database table, in a way that's straightforward and atomic. Basically I want to say:

UPDATE table SET item = append(item,'new text\r\n')
The database is currently Microsoft SQL Server, and the data type of this column is Text (basically a BLOB of text, as compared to a string). Ideally I'd like something portable, but I'll take what I can get.

We're writing into a database used by a proprietary application, so I can't make any changes to the table structure.

Currently I'm reading the column, appending the text, then writing it back out. This works, but is ugly, and prone to race conditions.

Any suggestions?


In reply to Appending text to a column in SQL by sgifford

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.