Reading text data from an image field

  • An application has been writing text data into a column with an image data type.

    selecting the field i receive '0x47006F006C006400....' type answers, is there a function to turn this back into a readable text string?

    Create Table TableName (ColumnName image, Field char (5))

    insert TableName (ColumnName,Field)

    Values ('Text entered in error', 'value')

    select * from TableName

    I have tried

    DECLARE @ptrval varbinary(16);

    SELECT @ptrval = TEXTPTR(ColumnName)

    FROM TableName where [Field] = 'Value'

    READTEXT TableName.ColumnName @ptrval 1 20;

    GO

    as described in BOL with no joy.

    many thanks in advance

    Ian

    oops, just edited by statements, sorry for the typo

  • I got there

    select cast ( cast( ColumnName as varbinary(max) ) as nvarchar(max)) from TableName

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

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