Using READTEXT in a Sproc

  • I want this:

    DECLARE @ptrval varbinary(16)

    SELECT @ptrval = TEXTPTR(MyNTextField)

    FROM MyTable

    WHERE id = 1

    DECLARE @MyNTextValue varchar(214)

    SET @MyNTextValue = READTEXT MyTable.MyNTextField @ptrval 0 214

    I've tried every variation I can think of, but it always fails in the last line. If I remove the SET clause, the strings from READTEXT appear in the query analyser output. Is there no way to use the value returned from READTEXT from within a sproc? Do I need to be using ADO to access this data?

    TIA, Josh

  • Try

    DECLARE @MyNTextValue varchar(214)

    SET @MyNTextValue = (SELECT SUBSTRING(MyNTextField ,1,214)

    FROM MyTable WHERE id = 1)

    Simon Sabin

    Co-author of SQL Server 2000 XML Distilled

    http://www.amazon.co.uk/exec/obidos/ASIN/1904347088


    Simon Sabin
    SQL Server MVP

    http://sqlblogcasts.com/blogs/simons

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

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