views:

594

answers:

1

I need to copy a set of data from one table to another that includes a BLOB column. I'm using an INSERT query with a subquery SELECT:

INSERT INTO dest_table(field1,field2,field3,blobfield,field4) (SELECT t.myfield1,t.myfield2,t.id,t.blobfield,'SomeConstant' FROM tablename t)

All fields get copied correct, except the BLOB. I know I'm missing something, but I have no idea on how to make this work. Search did not help me. Anyone know how to solve it?

I'd prefer a solution in pure SQL, but I can use Ruby too.

+2  A: 

After playing a bit here, I found the error: the original column is a MEDIUMBLOB, not a BLOB. It works fine when I just correct the type. Sorry for the dumb question.

Lailson Bandeira
No question is dumb question! Its matter of Ignorance.
Niger