Pre-requisite

b. Make sure to create a table with a varbinary(max) column, since the image column is not going to be supported in future versions. Also, make sure at least one column in the table can hold the value of the filename.

Let us assume that we want to upload all the .bmp files from the C:\Windows folder to the table myblob in the schema dbo on the test database.

Step 1

Execute the following script [using copy and paste or download the usp_uploadfiles.sql file]. This creates a stored procedure, usp_uploadfiles, on the master database so that it can be executed and called for any database.