I used a stored procedure for encapsulating that behaviour when I had a similar problem in the past, but if you don't have permission to add stored procedures you should be able to run the sequence of commands inline. I don't have access to a server to test with currently though, so your mileage may vary.
Something like this:
my $sql = 'DECLARE @ptrval binary(16);'
. ' SELECT @ptrval = TEXTPTR(item)'
. ' FROM table '
. ' WHERE whatever criteria;'
. ' UPDATETEXT table.item @ptrval NULL 0 ?';
$dbh->do($sql,{},"new text");
But of course that's horribly ugly.
So, a stored procedure to encapsulate the behaviour:
CREATE PROCEDURE dbo.APPEND_THINGY
@id int,
@new_text varchar(8000)
AS
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(item)
FROM table
WHERE id = @id
UPDATETEXT table.item @ptrval NULL 0 @new_text;
GO
And then in your code:
my $sql = q{exec append_thingy @new_text = ?};
$dbh->do($sql,{},"new text");
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.