Working with Documents
A platform which holds attachments, scans or images returns them as a column like any other, of a binary type. The grid shows such a column as its size rather than as its contents, and what is done with it is decided in the statement.
Reading One
A binary column is selected as any other column is. The sample database has DmsDocuments@dummy for exactly this purpose, so the shape of such a statement can be tried without a platform.
Writing the contents to a file is the work of Invantive Script, which has the statements for it, or of the Os driver of Built-in Drivers. Neither needs a program around it: a statement which reads the documents of a platform and writes them into a folder is a script of a few lines.
What It Costs
A document is bytes, and bytes travel. A statement which selects a binary column over a thousand rows moves those thousand documents whether or not anything is done with them, which the Connection Monitor reports under "Bytes Received".
Two habits follow:
- leave the binary column out of the statement while the rest of it is being written, and add it once the
whereis right; - fetch the documents in a run of their own rather than as part of a report which is looked at every morning.
Uploading
Where a platform accepts documents, they are inserted as a binary value like any other column; see Changing Data for what an insert against a cloud platform costs and why a large upload is planned rather than started.
Where the Types Are Documented
Which types are binary, how they convert and which functions apply to them is documented under SQL Data Type.