Passing result from READTEXT to a variable

  • Please would somebody suggest how one might pass the value returned by READTEXT to a variable (eg SET @MyVar = READTEXT ...)

  • Hi!!!!

    Pls check it more on BOL..

    USE pubs

    GO

    DECLARE @ptrval varbinary(16)

    SELECT @ptrval = TEXTPTR(pr_info)

       FROM pub_info pr INNER JOIN publishers p

          ON pr.pub_id = p.pub_id

          AND p.pub_name = 'New Moon Books'

    READTEXT pub_info.pr_info @ptrval 1 25

    GO

     

     


    Regards,

    Papillon

  • Thanks, but I want to put the result in a variable within the stored procedure; not just display it. BOL doesn't say anything about that.

  • DECLARE @var varchar(8000)

    SELECT @var = [textcol] FROM

    will retrieve the first 8000 chars

    SELECT @var = SUBSTRING([textcol],10,10) FROM

    will retrieve 10 chars starting at char 10

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

  • David, yes!

    I had been thinking that SUBSTRING was restricted to the first 8k but have just realised that it isn't. Thanks to you and everyone who has given time to this.

Viewing 5 posts - 1 through 4 (of 4 total)

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