0 Replies Latest reply on Jun 11, 2013 8:44 PM by Glowball

    CF8: Moving BLOB Data Between Tables


      I'm writing a script to copy BLOB data from a table in one database to a table in another database.  I'm able to copy non-binary data without any issues but I haven't figured out how to move binary.  I would think that I could just grab it out of one database via <cfquery> and put it in the other one via <cfquery> with no manipulation but it's giving me errors.  Specifically:


      ByteArray objects cannot be converted to strings


      I've tried converting it back and forth between Base64 and strings and messing with it but I'm not having any luck.  Why doesn't this work if both columns are BLOB (this is a simple demo)?


      <cfquery name="get" datasource="#db1#">

      SELECT file_binary FROM old_table WHERE id = 1


      <cfquery name="set" datasource="#db2#">

      INSERT INTO new_table (id, file_binary) VALUES (1, #get.file_binary#)