drop table attached_files; create table attached_files ( id integer primary key, file blob ); insert into attached_files (id, file) select attach_id, readfile('./php_engine/files/' || physical_filename) from phpbb_attachments_desc;