Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2002
    Posts
    24

    Unanswered: READTEXT return value assign to a varchar for ASE 12.5?

    I am using a READTEXT statement within a stored procedure to extract a blob of text that has been stored as a binary image. I need to then convert that binary representation back to Ascii. My question is.... is there a way to assign the 'returned' binary from the READTEXT statement to a variable so that I may use the variable in the CONVERT statement? I then need to have the Ascii result of the CONVERT command assigned to a variable for return to the calling routine.

    Here is an example of the code I have been trying to create (ASE 12.5).

    create table a (aa int, bb text)
    go
    insert into a values (1,"1111111111")
    go

    declare @myPtr varbinary(16)
    declare @a varchar (16384)


    select @myPtr=textptr (bb)
    from a
    where aa=1
    exec @a = ("READTEXT a.bb" + @myPtr + "1 20")
    /* Give my error - If I want the result set to @a */
    /* How do I assign @a to the return values from the READTEXT ? */


    __________________
    I am appreciative of any and all assistance I recieve.

    Thanks to all who have.

  2. #2
    Join Date
    Nov 2002
    Posts
    207
    Try this...

    exec @a = ("READTEXT a.bb " + @myPtr + " 1 20 using chars")

  3. #3
    Join Date
    Sep 2002
    Posts
    24
    Originally posted by mkalsi
    Try this...

    exec @a = ("READTEXT a.bb " + @myPtr + " 1 20 using chars")
    This will return the following error:
    Server 'myServer' line 131:
    Incorrect syntax near '('.

    I tried different way:

    exec @a = ("READTEXT a.bb " + @myPtr + " 1 20 using chars")
    exec @a = ('READTEXT a.bb ' + @myPtr + ' 1 20 using chars')
    exec @a = ("READTEXT a.bb " + @myPtr + " 1 20")
    exec @a = ("READTEXT a.bb " + @myPtr + "1 20")

    and all return the same error.

    Any one test it out?

  4. #4
    Join Date
    Feb 2005
    Posts
    19
    even i am facing a similar issue pls help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •