A common thing you may want to do when dealing with transactions involving various documents and files is insert them into you SQL Server database. The following code snippet let you load a file from the disk and insert it into your database.
INSERT INTO myTable (documentData)
SELECT * FROM
OPENROWSET(BULK N'c:\myDocument.doc', SINGLE_BLOB) as dt
Note that you need to name the select statement (here, I named it “dt”) or you will get this error message:
Server: Msg 491, Level 16, State 1, Line 3
A correlation name must be specified for the bulk rowset in the from clause.