I have figured it out. Not a clean solution in any way though.
I read the file: fid=fopen(FileLocation); FileData=fread(fid, 'uint8'); fclose(fid);
Then I just use fastinsert. I have to put filedata in a cell.
fastinsert(conn, 'DocumentTable', {'FileDescription', 'FileType', 'Id', 'TimeSaved', 'FileData'},[{FileDescription}, {Data.FileType}, num2cell(Id), {Data.TimeSaved}, {Data.FileData}])
However,while this looks clean it is quite messy getting it out.
% Query='SELECT * FROM DocumentTable'; % data=fetch(conn, Query); % test=data.FileData; % Trial=double(test{1}); % Trial(Trial<0)=Trial(Trial<0)+256; % fid=fopen('rout.docx', 'w'); % fwrite(fid, Trial, 'uint8'); % fclose(fid)
I have no idea why I have to add 256 to negative numbers but it seems to work. Tested it for both pdf and docx. There must be a better solution but until I find that one I will use this. It bypasses some permission problem when using SELECT * FROM OPENROWS BULK statements.