Results 1 to 5 of 5
  1. #1
    Join Date
    May 2007

    Arrow Unanswered: Converting (too big)Raw into Hex

    Hi there,

    Here at my work(in Germany) i have a big problem:

    Once a week there is a sqlscript, which should run and store data to a txt file.

    There is a tablle in which imagedata is stored in RAW format(that one with small boxes, Qmarks and dots...).

    Now i want to export it to the txtfile as HEX, so i can decode it by php further.

    With the thumbnail, also stores there everything is fine, the SQL looks that way:

    PHP Code:
    SELECt hex(thumbnailFROM picTable where id_pic=54985 
    The Data is then displayed as HEX. But the standart picture is to big. When i use the statement:
    PHP Code:
    SELECt hex(bigpicFROM picTable where id_pic=54985 
    i got the error message:

    An error occurred while running the query.

    The data type, length, or value of argument 1 of HEX is invalid.

    (SQL code = -171, SQL state = 42815)

    After some research i found that the maximum lenght is 16 336 bytes for the HEX-operation. The picture is nearly 30 000 bytes...
    Have anyone an idea how to fix that?
    I am not able here to accsess to the database direct...

    I have been working for days on it.

  2. #2
    Join Date
    May 2007

    Wrong forum!!!

    Uahh, wrong forum. Can anyone move this to SQL?

  3. #3
    Join Date
    Apr 2002
    Toronto, Canada
    the SQL forum is for standard SQL

    i'm guessing you want this moved to the SQL Server forum | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    May 2007
    Still not solved...

  5. #5
    Join Date
    Feb 2004
    Burbank & Santa Cruz de la Sierra
    What is this "hex" function you are referring to? I could not find any reference to it in BOL (though it certainly would be a handy one to have!).

    Regardless, assuming that there actually IS such an animal, can you consider breaking up the input data by sub-sections under your maximum size in the hex() function?

    Such as using SUBSTRING ( expression , start , length )?

    And then loop until the whole RAW data block is processed completely in bite-size chunks?
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

Posting Permissions

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